-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(typebox-validate): merge egg-typebox-validate plugin into monorepo #5583
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
Conversation
- Merge plugin from https://github.com/eggjs-community/egg-typebox-validate - Rename package to @eggjs/typebox-validate v4.0.0-beta.22 - Migrate to monorepo structure following CLAUDE.md standards - Update to use catalog dependencies (ajv, ajv-formats, ajv-keywords, @sinclair/typebox) - Migrate tests from Mocha to Vitest (11 tests passing) - Create standard tsdown.config.ts with unplugin-unused - Add proper TypeScript module augmentation in src/types.ts - Update imports to use 'egg' instead of '@eggjs/core' - Add plugin reference to root tsconfig.json 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new Egg plugin @eggjs/typebox-validate (AJV + TypeBox) with app/ctx integrations, decorator helpers, tests, docs, and build/test configs. Also updates workspace deps and TypeScript project refs, adjusts many packages' build scripts/tsconfigs/tsdown unbundle settings, removes a release workflow step, and adds Request.ctx in core. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Boot as AppBootHook
participant App as Egg Application
participant Cfg as config.typeboxValidate
participant AJV as Ajv Instance
Boot->>App: construct(app)
Note right of App: app.ajv = getAjvInstance()
App->>AJV: init formats, keywords, transforms
App->>Cfg: configDidLoad()
alt patchAjv provided
Cfg-->>AJV: patchAjv(app.ajv)
else
Note right of AJV: use default AJV config
end
sequenceDiagram
autonumber
participant Client
participant Router
participant Ctrl as Controller Method
participant Deco as @Validate Decorator
participant Ctx as ctx
participant AJV as app.ajv
Client->>Router: HTTP request
Router->>Ctrl: invoke action (wrapped by Deco)
activate Deco
Deco->>Ctx: extract data via GetData
Ctx->>AJV: validate(schema, data)
alt valid
Deco->>Ctrl: proceed
Ctrl-->>Client: 200 OK
else invalid
Deco->>Ctx: call custom handler or throw 422 with {errors,currentSchema,errorData}
Ctx-->>Client: 422 Validation Error
end
deactivate Deco
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (14)
✅ Files skipped from review due to trivial changes (2)
🚧 Files skipped from review as they are similar to previous changes (3)
🧰 Additional context used📓 Path-based instructions (10)**/*.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
**/test/**/*.test.ts📄 CodeRabbit inference engine (AGENTS.md)
Files:
{packages/!(cookies)/**/test/**/*.test.ts,tools/!(egg-bin)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
packages/*/tsconfig.json📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
{tsconfig.json,packages/*/tsconfig.json}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
{packages,plugins,tools}/**/tsconfig.json📄 CodeRabbit inference engine (CLAUDE.md)
Files:
{packages,plugins,tools}/**/tsdown.config.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
plugins/**/tsdown.config.ts📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/test/fixtures/**📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (9)📓 Common learnings📚 Learning: 2025-10-04T16:04:36.436ZApplied to files:
📚 Learning: 2025-09-14T08:41:30.618ZApplied to files:
📚 Learning: 2025-10-04T16:04:36.436ZApplied to files:
📚 Learning: 2025-10-04T16:04:36.436ZApplied to files:
📚 Learning: 2025-10-04T16:04:36.436ZApplied to files:
📚 Learning: 2025-09-14T08:41:30.618ZApplied to files:
📚 Learning: 2025-10-04T16:04:36.436ZApplied to files:
📚 Learning: 2025-09-14T08:41:30.618ZApplied to files:
🧬 Code graph analysis (1)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1)
⏰ 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). (18)
🔇 Additional comments (9)
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. Comment |
Summary of ChangesHello @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 integrates the Highlights
Using Gemini Code AssistThe 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
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 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
|
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.
Pull Request Overview
This PR merges the egg-typebox-validate plugin from the external community repository into the main Eggjs monorepo. The plugin provides TypeBox-based schema validation for TypeScript Egg projects, using Ajv for runtime validation while maintaining type safety through TypeBox schemas.
Key changes:
- Migration from standalone package to monorepo plugin structure following established patterns
- Upgrade to version 4.0.0-beta.22 with proper scoping as
@eggjs/typebox-validate - Test migration from Mocha to Vitest framework with all 11 tests passing
Reviewed Changes
Copilot reviewed 23 out of 25 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| pnpm-workspace.yaml | Adds catalog dependencies for TypeBox and Ajv libraries |
| plugins/typebox-validate/ | Complete plugin structure with source, tests, and configuration files |
| CLAUDE.md | Documents the new typebox-validate plugin in the monorepo overview |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| @@ -0,0 +1,15 @@ | |||
| import { Service } from 'egg'; | |||
| import { Static, Type } from '../../../../../../src/typebox.js'; | |||
| import { Validate } from '../../../../../../src/decorator.js'; | |||
Copilot
AI
Oct 5, 2025
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.
[nitpick] The relative import paths with multiple '../' are brittle and hard to maintain. Consider using workspace references or configuring module resolution to avoid these deep relative paths.
| import { Validate } from '../../../../../../src/decorator.js'; | |
| import { Validate } from '@src/decorator.js'; |
| @@ -0,0 +1,86 @@ | |||
| import { Controller } from 'egg'; | |||
| import { Static, Type } from '../../../../../../src/typebox.ts'; | |||
| import { ValidateFactory, Validate } from '../../../../../../src/decorator.ts'; | |||
Copilot
AI
Oct 5, 2025
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.
[nitpick] Similar to the service file, these deep relative import paths are maintenance-prone. Consider using workspace references or configuring module resolution.
| import { ValidateFactory, Validate } from '../../../../../../src/decorator.ts'; | |
| import { ValidateFactory, Validate } from '@src/decorator'; |
| // @ts-ignore | ||
| errors: this.app.ajv.errors, |
Copilot
AI
Oct 5, 2025
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.
Using @ts-ignore suppresses TypeScript error checking. Consider using proper type assertion or defining the type for app.ajv to avoid suppressing type safety.
| // @ts-ignore | |
| errors: this.app.ajv.errors, | |
| errors: (this.app as any).ajv.errors, |
| // @ts-expect-error - keyWords types are not fully compatible | ||
| keyWords(ajv, 'transform'); | ||
| // @ts-expect-error - addFormats types are not fully compatible | ||
| addFormats(ajv, [ |
Copilot
AI
Oct 5, 2025
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.
Using @ts-expect-error suppresses TypeScript checking. Consider updating the type definitions or using proper type assertions to maintain type safety.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## next #5583 +/- ##
==========================================
+ Coverage 81.04% 81.13% +0.08%
==========================================
Files 209 212 +3
Lines 5989 6017 +28
Branches 875 877 +2
==========================================
+ Hits 4854 4882 +28
Misses 1060 1060
Partials 75 75 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Code Review
This pull request successfully merges the egg-typebox-validate plugin into the monorepo. The changes are well-structured and follow the monorepo conventions. I've identified a few areas for improvement, mainly related to updating documentation to reflect the new package name and location, correcting a likely typo in the Node.js engine version, improving performance in error handling by conditionally stringifying schemas, and ensuring consistency in test file imports. Overall, this is a solid contribution that integrates a useful validation plugin into the core project.
| }, | ||
| "author": "xiekw2010", | ||
| "engines": { | ||
| "node": ">= 22.18.0" |
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.
The specified Node.js engine version >= 22.18.0 appears to be a typo, as it's not a valid Node.js version. Based on the CLAUDE.md file mentioning features from upcoming Node.js versions, you might have intended a version from the Node.js 22 release line. Please correct this to a valid and intended version, for example >=22.0.0 or a more recent stable version.
| "node": ">= 22.18.0" | |
| "node": ">=22.8.0" |
plugins/typebox-validate/README.md
Outdated
| [npm-image]: https://img.shields.io/npm/v/egg-typebox-validate.svg?style=flat-square | ||
| [npm-url]: https://npmjs.org/package/egg-typebox-validate | ||
| [codecov-image]: https://img.shields.io/codecov/c/github/eggjs-community/egg-typebox-validate.svg?style=flat-square | ||
| [codecov-url]: https://codecov.io/github/eggjs-community/egg-typebox-validate?branch=master | ||
| [snyk-image]: https://snyk.io/test/npm/egg-typebox-validate/badge.svg?style=flat-square | ||
| [snyk-url]: https://snyk.io/test/npm/egg-typebox-validate | ||
| [download-image]: https://img.shields.io/npm/dm/egg-typebox-validate.svg?style=flat-square | ||
| [download-url]: https://npmjs.org/package/egg-typebox-validate |
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.
The badge URLs and links point to the old standalone repository and package name. Now that the plugin is part of the eggjs/egg monorepo and published as @eggjs/typebox-validate, these should be updated. The Codecov URL might need adjustment based on your specific monorepo configuration (e.g., using flags).
| [npm-image]: https://img.shields.io/npm/v/egg-typebox-validate.svg?style=flat-square | |
| [npm-url]: https://npmjs.org/package/egg-typebox-validate | |
| [codecov-image]: https://img.shields.io/codecov/c/github/eggjs-community/egg-typebox-validate.svg?style=flat-square | |
| [codecov-url]: https://codecov.io/github/eggjs-community/egg-typebox-validate?branch=master | |
| [snyk-image]: https://snyk.io/test/npm/egg-typebox-validate/badge.svg?style=flat-square | |
| [snyk-url]: https://snyk.io/test/npm/egg-typebox-validate | |
| [download-image]: https://img.shields.io/npm/dm/egg-typebox-validate.svg?style=flat-square | |
| [download-url]: https://npmjs.org/package/egg-typebox-validate | |
| [npm-image]: https://img.shields.io/npm/v/@eggjs/typebox-validate.svg?style=flat-square | |
| [npm-url]: https://npmjs.org/package/@eggjs/typebox-validate | |
| [codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg/master?flag=typebox-validate&style=flat-square | |
| [codecov-url]: https://codecov.io/gh/eggjs/egg/tree/master/plugins/typebox-validate | |
| [snyk-image]: https://snyk.io/test/npm/@eggjs/typebox-validate/badge.svg?style=flat-square | |
| [snyk-url]: https://snyk.io/test/npm/@eggjs/typebox-validate | |
| [download-image]: https://img.shields.io/npm/dm/@eggjs/typebox-validate.svg?style=flat-square | |
| [download-url]: https://npmjs.org/package/@eggjs/typebox-validate |
plugins/typebox-validate/README.md
Outdated
| 这就是这个库想要解决的问题,对于参数校验,写一遍类型就够了: | ||
|
|
||
| ```diff | ||
| + import { Static, Type } from 'egg-typebox-validate/typebox'; |
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.
The package name in the import examples is outdated. It should be @eggjs/typebox-validate instead of egg-typebox-validate. This should be corrected throughout the README to avoid confusion for users.
| + import { Static, Type } from 'egg-typebox-validate/typebox'; | |
| + import { Static, Type } from '@eggjs/typebox-validate/typebox'; |
| this.throw(422, 'Validation Failed', { | ||
| code: 'invalid_param', | ||
| errorData: data, | ||
| currentSchema: JSON.stringify(schema), |
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.
Stringifying the validation schema on every validation failure can be a performance concern in production, especially with large and complex schemas, as it can lead to large log entries and high CPU usage. Consider making this conditional to only run in non-production environments.
| currentSchema: JSON.stringify(schema), | |
| currentSchema: this.app.config.env !== 'prod' ? JSON.stringify(schema) : undefined, |
| ctx.throw(422, message, { | ||
| code: 'invalid_param', | ||
| errorData: data, | ||
| currentSchema: JSON.stringify(schema), |
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.
Stringifying the validation schema on every validation failure can be a performance concern in production, especially with large and complex schemas. This can lead to large log entries and high CPU usage. It's better to make this conditional and only include the full schema in non-production environments.
| currentSchema: JSON.stringify(schema), | |
| currentSchema: app.config.env !== 'prod' ? JSON.stringify(schema) : undefined, |
| import { Static, Type } from '../../../../../../src/typebox.js'; | ||
| import { Validate } from '../../../../../../src/decorator.js'; | ||
| import { TYPEBOX_BODY } from '../controller/home.js'; |
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.
The imports in this test file use .js extensions, which is inconsistent with the project's convention of using .ts extensions for TypeScript module imports, as documented in CLAUDE.md. For consistency and to adhere to project standards, please update these to use the .ts extension.
| import { Static, Type } from '../../../../../../src/typebox.js'; | |
| import { Validate } from '../../../../../../src/decorator.js'; | |
| import { TYPEBOX_BODY } from '../controller/home.js'; | |
| import { Static, Type } from '../../../../../../src/typebox.ts'; | |
| import { Validate } from '../../../../../../src/decorator.ts'; | |
| import { TYPEBOX_BODY } from '../controller/home.ts'; |
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: 5
🧹 Nitpick comments (1)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/tsconfig.json (1)
1-10: Consider consistency with other test fixtures.While test fixtures have flexibility in their TypeScript configuration, verify whether extending
@eggjs/tsconfigdirectly is the preferred approach for fixtures or if there's a standard pattern being followed across other test fixtures in the monorepo.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (24)
CLAUDE.md(1 hunks)plugins/typebox-validate/LICENSE(1 hunks)plugins/typebox-validate/README.md(1 hunks)plugins/typebox-validate/package.json(1 hunks)plugins/typebox-validate/src/app.ts(1 hunks)plugins/typebox-validate/src/app/extend/context.ts(1 hunks)plugins/typebox-validate/src/config/config.default.ts(1 hunks)plugins/typebox-validate/src/decorator.ts(1 hunks)plugins/typebox-validate/src/index.ts(1 hunks)plugins/typebox-validate/src/typebox.ts(1 hunks)plugins/typebox-validate/src/types.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/router.ts(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.json(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/tsconfig.json(1 hunks)plugins/typebox-validate/test/index.test.ts(1 hunks)plugins/typebox-validate/tsconfig.json(1 hunks)plugins/typebox-validate/tsdown.config.ts(1 hunks)plugins/typebox-validate/vitest.config.ts(1 hunks)pnpm-workspace.yaml(2 hunks)tsconfig.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (17)
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
plugins/typebox-validate/vitest.config.tsplugins/typebox-validate/src/index.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.tsplugins/typebox-validate/src/types.tsplugins/typebox-validate/src/typebox.tsplugins/typebox-validate/src/decorator.tsplugins/typebox-validate/src/config/config.default.tsplugins/typebox-validate/tsdown.config.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.tsplugins/typebox-validate/src/app/extend/context.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.tsplugins/typebox-validate/test/index.test.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tsplugins/typebox-validate/src/app.ts
{packages/!(cookies)/**/vitest.config.ts,tools/!(egg-bin)/**/vitest.config.ts,plugins/**/vitest.config.ts}
📄 CodeRabbit inference engine (CLAUDE.md)
All packages (except cookies and egg-bin) must include a vitest.config.ts for tests
Files:
plugins/typebox-validate/vitest.config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Enable TypeScript strict mode in all TypeScript packages
Use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes
Use readonly modifiers where appropriate
Avoid the any type; use unknown when the type is truly unknown
Files:
plugins/typebox-validate/vitest.config.tsplugins/typebox-validate/src/index.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.tsplugins/typebox-validate/src/types.tsplugins/typebox-validate/src/typebox.tsplugins/typebox-validate/src/decorator.tsplugins/typebox-validate/src/config/config.default.tsplugins/typebox-validate/tsdown.config.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.tsplugins/typebox-validate/src/app/extend/context.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.tsplugins/typebox-validate/test/index.test.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tsplugins/typebox-validate/src/app.ts
{packages,plugins,tools}/**/tsconfig.json
📄 CodeRabbit inference engine (CLAUDE.md)
All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Files:
plugins/typebox-validate/tsconfig.jsonplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/tsconfig.json
**/test/fixtures/**
📄 CodeRabbit inference engine (AGENTS.md)
Put reusable test data under test/fixtures/
Files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.jsonplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/tsconfig.jsonplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
plugins/**/src/types.ts
📄 CodeRabbit inference engine (CLAUDE.md)
All plugins must define src/types.ts that augments the 'egg' module and uses .ts extensions in relative type imports
Files:
plugins/typebox-validate/src/types.ts
{packages,plugins,tools}/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Each package should include tsdown.config.ts for unbundled ESM builds
Files:
plugins/typebox-validate/tsdown.config.ts
plugins/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unused.level: 'error', dts: true, exports.devExports: true)
Files:
plugins/typebox-validate/tsdown.config.ts
pnpm-workspace.yaml
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Define dependency versions via the catalog section in pnpm-workspace.yaml and reference them with "catalog:"
Files:
pnpm-workspace.yaml
{pnpm-workspace.yaml,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
Use pnpm catalog mode: external deps referenced as "catalog:" and kept in pnpm-workspace.yaml catalog
Files:
pnpm-workspace.yamlplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.jsonplugins/typebox-validate/package.json
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")
Files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.jsonplugins/typebox-validate/package.json
plugins/**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
plugins/**/package.json: All plugins must include egg as a peerDependency with version "workspace:"
Plugin package.json exports must map TypeScript sources for dev and mirror them under publishConfig.exports to dist/.js for publish
All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
Files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.jsonplugins/typebox-validate/package.json
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}: All packages must include a typecheck script running "tsc --noEmit"
All packages must use oxlint for linting with "lint": "oxlint --type-aware" and provide "lint:fix"
Files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.jsonplugins/typebox-validate/package.json
{tsconfig.json,packages/*/tsconfig.json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable strict TypeScript mode across all packages
Files:
tsconfig.json
tsconfig.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Root tsconfig.json must include all packages in the references array
Files:
tsconfig.json
**/test/**/*.test.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/test/**/*.test.ts: Place test suites following Vitest discovery: /test//*.test.ts
Mirror the repository test pattern when adding new suitesTest files must follow the naming pattern test/**/*.test.ts
Files:
plugins/typebox-validate/test/index.test.ts
{packages/!(cookies)/**/test/**/*.test.ts,tools/!(egg-bin)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts}
📄 CodeRabbit inference engine (CLAUDE.md)
Vitest-based packages should write tests under test/**/*.test.ts and import test utilities from 'vitest'
Files:
plugins/typebox-validate/test/index.test.ts
🧠 Learnings (15)
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Applied to files:
plugins/typebox-validate/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/tsdown.config.ts : All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unused.level: 'error', dts: true, exports.devExports: true)
Applied to files:
plugins/typebox-validate/tsconfig.jsonplugins/typebox-validate/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"
Applied to files:
plugins/typebox-validate/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/egg/src/config/config.default.ts,packages/egg/src/config/plugin.ts} : Default framework configuration and built-in plugin list must be maintained in their respective config files
Applied to files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/src/types.ts : All plugins must define src/types.ts that augments the 'egg' module and uses .ts extensions in relative type imports
Applied to files:
plugins/typebox-validate/src/types.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tsplugins/typebox-validate/package.json
📚 Learning: 2025-09-18T07:56:17.417Z
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: Applies to **/*.ts : Re-export types thoughtfully to keep the public API stable
Applied to files:
plugins/typebox-validate/src/typebox.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds
Applied to files:
plugins/typebox-validate/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsdown.config.ts : Each package must provide a tsdown.config.ts for unbundled ESM builds
Applied to files:
plugins/typebox-validate/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to pnpm-workspace.yaml : Define dependency versions via the catalog section in pnpm-workspace.yaml and reference them with "catalog:"
Applied to files:
pnpm-workspace.yaml
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {pnpm-workspace.yaml,packages/**/package.json,plugins/**/package.json,tools/**/package.json} : Use pnpm catalog mode: external deps referenced as "catalog:" and kept in pnpm-workspace.yaml catalog
Applied to files:
pnpm-workspace.yaml
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/!(cookies)/**/test/**/*.test.ts,tools/!(egg-bin)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts} : Vitest-based packages should write tests under test/**/*.test.ts and import test utilities from 'vitest'
Applied to files:
plugins/typebox-validate/test/index.test.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/**/test/**/*.test.ts : Use import { describe, it } from 'vitest' in tests
Applied to files:
plugins/typebox-validate/test/index.test.ts
📚 Learning: 2025-09-18T07:56:17.417Z
Learnt from: CR
PR: eggjs/egg#0
File: AGENTS.md:0-0
Timestamp: 2025-09-18T07:56:17.417Z
Learning: For features affecting HTTP or process orchestration, add regression tests that exercise both the CommonJS and TypeScript example apps
Applied to files:
plugins/typebox-validate/test/index.test.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {tools/egg-bin/test/**/*.test.ts,packages/cookies/test/**/*.test.ts} : egg-bin and cookies packages use Mocha for tests under test/**/*.test.ts
Applied to files:
plugins/typebox-validate/test/index.test.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/egg/src/config/plugin.ts} : Built-in plugin configurations must be defined in packages/egg/src/config/plugin.ts
Applied to files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
🧬 Code graph analysis (7)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts (1)
packages/egg/src/lib/types.ts (2)
PowerPartial(82-82)EggAppConfig(124-295)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (2)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1)
TYPEBOX_BODY(13-20)plugins/typebox-validate/src/decorator.ts (1)
Validate(33-42)
plugins/typebox-validate/src/types.ts (2)
packages/egg/src/lib/types.ts (1)
EggAppConfig(124-295)plugins/typebox-validate/src/config/config.default.ts (1)
TypeboxValidateConfig(3-5)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1)
plugins/typebox-validate/src/decorator.ts (2)
ValidateFactory(10-31)Validate(33-42)
plugins/typebox-validate/test/index.test.ts (1)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.ts (1)
app(3-9)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts (1)
packages/egg/src/lib/types.ts (1)
EggPlugin(314-328)
plugins/typebox-validate/src/app.ts (1)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts (1)
config(4-37)
⏰ 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: Socket Security: Pull Request Alerts
- GitHub Check: Test (ubuntu-latest, 24, tools)
- GitHub Check: Test (macos-latest, 22, plugins)
- GitHub Check: Test (macos-latest, 22, tools)
- GitHub Check: Test (windows-latest, 24, packages)
- GitHub Check: Test (macos-latest, 24, packages)
- GitHub Check: Test (windows-latest, 22, tools)
- GitHub Check: Test (ubuntu-latest, 24, plugins)
- GitHub Check: Test (windows-latest, 24, plugins)
- GitHub Check: Test (ubuntu-latest, 24, packages)
- GitHub Check: Test (windows-latest, 22, packages)
- GitHub Check: Test (ubuntu-latest, 22, plugins)
- GitHub Check: Test (ubuntu-latest, 22, packages)
- GitHub Check: Test (macos-latest, 22, packages)
- GitHub Check: Test (windows-latest, 22, plugins)
- GitHub Check: Test (macos-latest, 24, plugins)
- GitHub Check: Test egg-bin (ubuntu-latest, 22)
- GitHub Check: Test egg-bin (windows-latest, 22)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
plugins/typebox-validate/tsdown.config.ts (2)
1-4: LGTM! Configuration follows the standard template.The configuration correctly implements all required properties from the standard plugin template: entry pattern, unused error level, dts generation, and devExports.
Based on learnings
Also applies to: 6-13
5-5: Verify ifunbundleshould be enabled.The coding guideline states "Each package should include tsdown.config.ts for unbundled ESM builds", which suggests
unbundle: trueshould be enabled. However, this option is currently commented out.Please confirm whether this was intentional or if the option should be uncommented to align with the unbundled ESM build requirement.
As per coding guidelines
plugins/typebox-validate/LICENSE (1)
1-22: LGTM!The MIT License is properly formatted with appropriate copyright attributions for both the original author (David Tse) and the eggjs-community.
CLAUDE.md (1)
121-127: LGTM!The documentation for the typebox-validate plugin is well-structured and follows the established pattern used for other plugins in the monorepo. It clearly describes the key features including schema validation, Ajv integration, context methods, decorator support, and TypeBox re-exports.
tsconfig.json (1)
82-84: LGTM!The TypeScript project reference for the typebox-validate plugin is correctly added to the references array, properly positioned in the sequence of plugins.
plugins/typebox-validate/tsconfig.json (1)
1-6: LGTM!The TypeScript configuration correctly extends the root configuration and sets the baseUrl as required by the coding guidelines.
Based on learnings
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts (1)
1-5: LGTM!The plugin configuration follows the standard Egg.js pattern with proper typing. The empty configuration is appropriate for a test fixture that relies on default plugin settings.
plugins/typebox-validate/test/index.test.ts (1)
23-182: Thorough end-to-end coverage.Solid job exercising the plugin across happy paths, error paths, and custom formats—this makes the runtime contract very clear.
| @@ -0,0 +1,24 @@ | |||
| import { Context } from 'egg'; | |||
| import type { Schema } from 'ajv/dist/2019.js'; | |||
| import '../../types.ts'; | |||
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.
Side-effect import must target the built .js file.
When this module is compiled, the emitted require('../../types.ts') fails because .ts isn’t resolvable at runtime. Point it at the generated .js instead.
-import '../../types.ts';
+import '../../types.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 '../../types.ts'; | |
| import '../../types.js'; |
🤖 Prompt for AI Agents
In plugins/typebox-validate/src/app/extend/context.ts around line 3 the file
uses a side-effect import of a TypeScript source file ("../../types.ts") which
will emit a runtime require that fails; update the import to point to the
compiled JavaScript artifact (e.g. import '../../types.js') or otherwise
reference the built output path used by your bundler so the runtime can resolve
the module.
| import './config/config.default.ts'; | ||
| import './app/extend/context.ts'; | ||
| import './app.ts'; | ||
| import './types.ts'; |
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.
Drop .ts extensions in runtime imports.
After build the emitted JS will still require('./config/config.default.ts'), which Node can’t resolve (no .ts loader ships in production). This crashes the plugin on load. Switch these specifiers to the .js build artifacts.
-import './config/config.default.ts';
-import './app/extend/context.ts';
-import './app.ts';
-import './types.ts';
+import './config/config.default.js';
+import './app/extend/context.js';
+import './app.js';
+import './types.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 './config/config.default.ts'; | |
| import './app/extend/context.ts'; | |
| import './app.ts'; | |
| import './types.ts'; | |
| import './config/config.default.js'; | |
| import './app/extend/context.js'; | |
| import './app.js'; | |
| import './types.js'; |
🤖 Prompt for AI Agents
In plugins/typebox-validate/src/index.ts lines 1-4, the runtime imports include
.ts extensions which will remain in emitted JS and fail in Node; remove the .ts
extensions (or change the specifiers to the corresponding .js build artifact
paths) so the compiled output imports resolvable JS modules (e.g. import
'./config/config.default' / './app/extend/context' / './app' / './types' instead
of including .ts).
| { | ||
| "name": "egg-typebox-validate-test", | ||
| "version": "0.0.1", | ||
| "type": "module" | ||
| } |
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 | 🟠 Major
Add Node.js version requirement.
Test fixture packages should also declare the minimum Node.js version requirement to ensure consistency across the monorepo.
As per coding guidelines
Apply this diff:
{
"name": "egg-typebox-validate-test",
"version": "0.0.1",
- "type": "module"
+ "type": "module",
+ "engines": {
+ "node": ">=22.18.0"
+ }
}📝 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.
| { | |
| "name": "egg-typebox-validate-test", | |
| "version": "0.0.1", | |
| "type": "module" | |
| } | |
| { | |
| "name": "egg-typebox-validate-test", | |
| "version": "0.0.1", | |
| "type": "module", | |
| "engines": { | |
| "node": ">=22.18.0" | |
| } | |
| } |
🤖 Prompt for AI Agents
In
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.json
lines 1-5, the package.json is missing the Node.js engines field; add an
"engines" entry declaring the minimum Node.js version required for the monorepo
(for example add "engines": { "node": ">=18" }) so the test fixture aligns with
repo guidelines and enforces the Node version during installs.
| '@eggjs/tegg-plugin': ^3.2.2 | ||
| '@fengmk2/ps-tree': ^2.0.1 | ||
| '@oclif/core': ^4.2.0 | ||
| '@sinclair/typebox': ^0.23.0 |
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.
🧩 Analysis chain
Verify package versions are up-to-date.
The specified versions for the TypeBox ecosystem dependencies appear to be outdated:
@sinclair/typebox: ^0.23.0- TypeBox has released much newer versions (3.x+ series)ajv: ^8.8.2- Latest stable in the 8.x series is 8.11.x+ajv-formatsandajv-keywordsversions should also be verified
Ensure these versions are intentionally pinned or update them to the latest compatible versions to benefit from bug fixes, performance improvements, and security patches.
Run the following script to check the latest versions:
Also applies to: 62-64
🏁 Script executed:
#!/bin/bash
# Check latest versions of TypeBox ecosystem packages
echo "=== @sinclair/typebox ==="
npm view @sinclair/typebox version dist-tags
echo -e "\n=== ajv ==="
npm view ajv version dist-tags
echo -e "\n=== ajv-formats ==="
npm view ajv-formats version dist-tags
echo -e "\n=== ajv-keywords ==="
npm view ajv-keywords version dist-tagsLength of output: 384
Update outdated package versions
pnpm-workspace.yaml lines 20, 62–64:
- bump
@sinclair/typeboxfrom^0.23.0to^0.34.41 - bump
ajvfrom^8.8.2to^8.17.1 - bump
ajv-formatsfrom^2.1.1to^3.0.1 ajv-keywordsremains at^5.1.0(latest)
Ensure compatibility after these upgrades.
🤖 Prompt for AI Agents
In pnpm-workspace.yaml around lines 20 and 62–64, the package version
constraints are outdated; update '@sinclair/typebox' from ^0.23.0 to ^0.34.41,
'ajv' from ^8.8.2 to ^8.17.1, and 'ajv-formats' from ^2.1.1 to ^3.0.1 (leave
'ajv-keywords' at ^5.1.0), then run a local install and the test suite to verify
compatibility and adjust any breaking-change usages (schema compilation/options
or API changes) caused by the upgrades.
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: 17
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (7)
plugins/multipart/package.json (1)
84-90: Add the mandatedcleanscript.Plugin package.json files must expose a
cleanscript (rimraf dist …) alongside build/typecheck/lint/test per CLAUDE.md. This entry is missing here, so please add it—ideally reuse it from the build pipeline, e.g.:"devDependencies": { … }, "scripts": { - "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", + "clean": "rimraf dist *.tsbuildinfo", + "build": "pnpm run clean && tsdown && tsc -p tsconfig.build.json", "typecheck": "tsc --noEmit", "lint": "oxlint --type-aware", "lint:fix": "npm run lint -- --fix", "test": "npm run lint:fix && vitest", "prepublishOnly": "npm run build" },packages/extend2/package.json (1)
17-21: Align lint scripts with repo policy.Coding guidelines require every package to expose
"lint": "oxlint --type-aware"and provide alint:fixcompanion, but this block still runs plainoxlintand omitslint:fix. Please update the scripts accordingly—for example:- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", - "typecheck": "tsc --noEmit", - "lint": "oxlint", - "test": "vitest run", - "prepublishOnly": "pnpm run build" + "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", + "typecheck": "tsc --noEmit", + "lint": "oxlint --type-aware", + "lint:fix": "oxlint --type-aware --fix", + "test": "vitest run", + "prepublishOnly": "pnpm run build"As per coding guidelines
plugins/development/package.json (1)
68-74: Reorder build steps to avoid deleting the freshly built bundle.Running
tsdownand then immediatelyrimraf dist *.tsbuildinfowipes out the artifacts you just produced, sotsc -p tsconfig.build.jsonends up emitting only the declaration files. The published package will miss its JS runtime output. Please move the cleanup to the front (or drop it if redundant) so we clean first, then bundle, then emit declarations.-"build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", +"build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",packages/supertest/package.json (1)
61-62: Add the requiredlint:fixscript.Repo guidelines mandate both
lintandlint:fix. Please add"lint:fix": "oxlint --type-aware --fix"alongside the existing lint script.Based on learnings
plugins/security/package.json (1)
145-151: Add the requiredcleanscriptPer our plugin guidelines, every plugin package.json must expose a
cleanscript (typicallyrimraf dist). Please add it back so this package stays in compliance.plugins/session/package.json (1)
67-73: Add the requiredcleanscript per plugin standardsPer our plugin package guidelines, every plugin must expose a
cleanscript (rimraf dist). Please add it so automation can invoke cleanup consistently. As per coding guidelines"scripts": { + "clean": "rimraf dist", "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",packages/koa/tsdown.config.ts (1)
7-14: Adddts: truefor consistency with other packages.All other packages in this PR (packages/core, packages/cookies, packages/supertest, packages/cluster, and plugins) explicitly set
dts: truein their tsdown configurations. While tsdown may auto-enable dts generation whenpackage.jsonhas atypesfield, explicit configuration improves consistency and clarity across the monorepo.Apply this diff to add the missing
dtsoption:export default defineConfig({ entry: { index: 'src/index.ts', }, unbundle: true, + dts: true, unused: { level: 'error', ignore: ['@types/content-disposition'], },
♻️ Duplicate comments (2)
plugins/typebox-validate/README.md (2)
10-15: Badges still target the old standalone repository.These Codecov links need to point at the monorepo paths (with a flag if you segment coverage). Please swap
eggjs-community/@eggjs-typebox-validatefor theeggjs/eggURLs so the badges render correctly for this package.-[codecov-image]: https://img.shields.io/codecov/c/github/eggjs-community/@eggjs/typebox-validate.svg?style=flat-square -[codecov-url]: https://codecov.io/github/eggjs-community/@eggjs/typebox-validate?branch=master +[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg/master?flag=typebox-validate&style=flat-square +[codecov-url]: https://codecov.io/gh/eggjs/egg/tree/master/plugins/typebox-validate
60-156: Update all usage docs to the new@eggjs/typebox-validatescope.Install commands, plugin config, and import examples still reference
egg-typebox-validate. Anyone copy/pasting these will install the wrong package or fail to resolve imports. Please change them to@eggjs/typebox-validate(including subpath imports like/typeboxand/decorator).- npm i egg-typebox-validate -S + npm i @eggjs/typebox-validate -S - npm i egg-typebox-validate@3 -S + npm i @eggjs/typebox-validate@3 -S - package: 'egg-typebox-validate', + package: '@eggjs/typebox-validate', - import { Static, Type } from 'egg-typebox-validate/typebox'; + import { Static, Type } from '@eggjs/typebox-validate/typebox'; - import { Validate, ValidateFactory } from 'egg-typebox-validate/decorator'; + import { Validate, ValidateFactory } from '@eggjs/typebox-validate/decorator';Also applies to: 293-345
🧹 Nitpick comments (3)
plugins/logrotator/tsdown.config.ts (1)
5-5: LGTM! Consistent standardization of unbundled builds.Enabling
unbundle: truealigns with the project-wide adjustment being applied across multiple plugins in this PR. For a monorepo plugin, unbundling is appropriate as dependencies are managed at the workspace level, and this keeps the build output clean with external import references intact.Note: The coding guidelines specify the standard tsdown template for plugins but don't currently mention
unbundle: true. If this is becoming the new standard (as suggested by the consistent application across plugins), consider updating CLAUDE.md or the relevant guidelines to reflect this requirement.plugins/typebox-validate/src/app/extend/context.ts (1)
4-23: Conditional schema stringification for production performance.The
tValidatemethod stringifies the schema on every validation failure (line 12), which can cause performance issues with large schemas in production. This creates both CPU overhead and bloated log entries. Consider making this conditional based on the environment:Apply this diff to optimize for production:
this.throw(422, 'Validation Failed', { code: 'invalid_param', errorData: data, - currentSchema: JSON.stringify(schema), + currentSchema: this.app.config.env !== 'prod' ? JSON.stringify(schema) : undefined, errors: ajv.errors, });Based on past review comments.
plugins/typebox-validate/src/decorator.ts (1)
33-42: Conditional schema stringification for production performance.Similar to the concern in
context.ts, stringifying the schema on every validation failure (line 39) can cause performance issues with large schemas in production, leading to high CPU usage and bloated logs.Apply this diff to optimize for production:
ctx.throw(422, message, { code: 'invalid_param', errorData: data, - currentSchema: JSON.stringify(schema), + currentSchema: app.config.env !== 'prod' ? JSON.stringify(schema) : undefined, errors: app.ajv.errors, });Based on past review comments.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (107)
.github/workflows/release.yml(0 hunks)packages/cluster/package.json(1 hunks)packages/cluster/tsconfig.build.json(1 hunks)packages/cluster/tsconfig.json(1 hunks)packages/cluster/tsdown.config.ts(1 hunks)packages/cookies/package.json(1 hunks)packages/cookies/tsconfig.build.json(1 hunks)packages/cookies/tsconfig.json(1 hunks)packages/cookies/tsdown.config.ts(1 hunks)packages/core/example/middleware/hello.ts(1 hunks)packages/core/package.json(1 hunks)packages/core/src/egg.ts(1 hunks)packages/core/tsconfig.build.json(1 hunks)packages/core/tsconfig.json(1 hunks)packages/core/tsdown.config.ts(1 hunks)packages/egg/package.json(1 hunks)packages/egg/tsconfig.build.json(1 hunks)packages/egg/tsconfig.json(1 hunks)packages/extend2/package.json(1 hunks)packages/extend2/tsconfig.build.json(1 hunks)packages/extend2/tsconfig.json(1 hunks)packages/extend2/tsdown.config.ts(1 hunks)packages/koa-static-cache/package.json(1 hunks)packages/koa-static-cache/tsconfig.build.json(1 hunks)packages/koa-static-cache/tsconfig.json(1 hunks)packages/koa-static-cache/tsdown.config.ts(1 hunks)packages/koa/package.json(1 hunks)packages/koa/tsconfig.build.json(1 hunks)packages/koa/tsconfig.json(1 hunks)packages/koa/tsdown.config.ts(1 hunks)packages/router/package.json(1 hunks)packages/router/tsconfig.build.json(1 hunks)packages/router/tsconfig.json(1 hunks)packages/router/tsdown.config.ts(1 hunks)packages/supertest/package.json(1 hunks)packages/supertest/tsconfig.build.json(1 hunks)packages/supertest/tsconfig.json(1 hunks)packages/supertest/tsdown.config.ts(1 hunks)packages/utils/package.json(1 hunks)packages/utils/tsconfig.build.json(1 hunks)packages/utils/tsconfig.json(1 hunks)packages/utils/tsdown.config.ts(1 hunks)plugins/development/package.json(1 hunks)plugins/development/tsconfig.build.json(1 hunks)plugins/development/tsconfig.json(1 hunks)plugins/development/tsdown.config.ts(1 hunks)plugins/i18n/package.json(1 hunks)plugins/i18n/tsconfig.build.json(1 hunks)plugins/i18n/tsconfig.json(1 hunks)plugins/i18n/tsdown.config.ts(1 hunks)plugins/jsonp/package.json(1 hunks)plugins/jsonp/tsconfig.build.json(1 hunks)plugins/jsonp/tsconfig.json(1 hunks)plugins/jsonp/tsdown.config.ts(1 hunks)plugins/logrotator/package.json(1 hunks)plugins/logrotator/tsconfig.build.json(1 hunks)plugins/logrotator/tsconfig.json(1 hunks)plugins/logrotator/tsdown.config.ts(1 hunks)plugins/mock/package.json(1 hunks)plugins/mock/tsconfig.build.json(1 hunks)plugins/mock/tsconfig.json(1 hunks)plugins/mock/tsdown.config.ts(1 hunks)plugins/multipart/package.json(1 hunks)plugins/multipart/tsconfig.build.json(1 hunks)plugins/multipart/tsconfig.json(1 hunks)plugins/multipart/tsdown.config.ts(1 hunks)plugins/onerror/package.json(1 hunks)plugins/onerror/tsconfig.build.json(1 hunks)plugins/onerror/tsconfig.json(1 hunks)plugins/onerror/tsdown.config.ts(1 hunks)plugins/schedule/package.json(1 hunks)plugins/schedule/tsconfig.build.json(1 hunks)plugins/schedule/tsconfig.json(1 hunks)plugins/schedule/tsdown.config.ts(1 hunks)plugins/security/package.json(1 hunks)plugins/security/tsconfig.build.json(1 hunks)plugins/security/tsconfig.json(1 hunks)plugins/session/package.json(1 hunks)plugins/session/tsconfig.build.json(1 hunks)plugins/session/tsconfig.json(1 hunks)plugins/session/tsdown.config.ts(1 hunks)plugins/static/package.json(1 hunks)plugins/static/tsconfig.build.json(1 hunks)plugins/static/tsconfig.json(1 hunks)plugins/static/tsdown.config.ts(1 hunks)plugins/tracer/package.json(1 hunks)plugins/tracer/tsconfig.build.json(1 hunks)plugins/tracer/tsconfig.json(1 hunks)plugins/tracer/tsdown.config.ts(1 hunks)plugins/typebox-validate/README.md(1 hunks)plugins/typebox-validate/package.json(1 hunks)plugins/typebox-validate/src/app.ts(1 hunks)plugins/typebox-validate/src/app/extend/context.ts(1 hunks)plugins/typebox-validate/src/config/config.default.ts(1 hunks)plugins/typebox-validate/src/decorator.ts(1 hunks)plugins/typebox-validate/src/index.ts(1 hunks)plugins/typebox-validate/src/types.ts(1 hunks)plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts(1 hunks)plugins/typebox-validate/test/index.test.ts(1 hunks)plugins/typebox-validate/tsconfig.build.json(1 hunks)plugins/typebox-validate/tsdown.config.ts(1 hunks)plugins/typebox-validate/vitest.config.ts(1 hunks)plugins/view/package.json(1 hunks)plugins/view/tsconfig.build.json(1 hunks)plugins/view/tsconfig.json(1 hunks)plugins/watcher/package.json(1 hunks)plugins/watcher/tsconfig.build.json(1 hunks)
⛔ Files not processed due to max files limit (2)
- plugins/watcher/tsconfig.json
- plugins/watcher/tsdown.config.ts
💤 Files with no reviewable changes (1)
- .github/workflows/release.yml
✅ Files skipped from review due to trivial changes (28)
- packages/cluster/tsconfig.build.json
- plugins/multipart/tsconfig.build.json
- plugins/jsonp/package.json
- packages/cluster/package.json
- plugins/static/tsconfig.json
- plugins/view/tsconfig.json
- plugins/schedule/tsconfig.build.json
- plugins/mock/tsconfig.json
- plugins/tracer/tsconfig.build.json
- plugins/onerror/tsconfig.build.json
- packages/extend2/tsconfig.json
- plugins/mock/tsconfig.build.json
- packages/utils/tsconfig.json
- packages/koa-static-cache/tsconfig.build.json
- packages/supertest/tsconfig.json
- plugins/i18n/tsconfig.build.json
- packages/router/tsconfig.build.json
- packages/core/example/middleware/hello.ts
- packages/egg/tsconfig.build.json
- plugins/development/tsconfig.json
- plugins/jsonp/tsconfig.build.json
- packages/egg/tsconfig.json
- plugins/typebox-validate/test/index.test.ts
- plugins/session/tsconfig.build.json
- plugins/jsonp/tsconfig.json
- plugins/security/tsconfig.json
- packages/koa/tsconfig.build.json
- packages/cookies/package.json
🚧 Files skipped from review as they are similar to previous changes (5)
- plugins/typebox-validate/src/index.ts
- plugins/typebox-validate/src/config/config.default.ts
- plugins/typebox-validate/src/app.ts
- plugins/typebox-validate/vitest.config.ts
- plugins/typebox-validate/tsdown.config.ts
🧰 Additional context used
📓 Path-based instructions (16)
{packages,plugins,tools}/**/tsconfig.json
📄 CodeRabbit inference engine (CLAUDE.md)
All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Files:
plugins/onerror/tsconfig.jsonpackages/cluster/tsconfig.jsonplugins/logrotator/tsconfig.jsonpackages/koa/tsconfig.jsonplugins/session/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonplugins/multipart/tsconfig.jsonplugins/tracer/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/i18n/tsconfig.jsonpackages/core/tsconfig.jsonpackages/router/tsconfig.jsonplugins/schedule/tsconfig.json
packages/*/tsconfig.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"
Files:
packages/cluster/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/cookies/tsconfig.jsonpackages/core/tsconfig.jsonpackages/router/tsconfig.json
{tsconfig.json,packages/*/tsconfig.json}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Enable strict TypeScript mode across all packages
Files:
packages/cluster/tsconfig.jsonpackages/koa/tsconfig.jsonpackages/koa-static-cache/tsconfig.jsonpackages/cookies/tsconfig.jsonpackages/core/tsconfig.jsonpackages/router/tsconfig.json
packages/*/tsdown.config.ts
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Each package must provide a tsdown.config.ts for unbundled ESM builds
Files:
packages/core/tsdown.config.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/koa-static-cache/tsdown.config.tspackages/extend2/tsdown.config.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tspackages/cookies/tsdown.config.ts
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
packages/core/tsdown.config.tspackages/core/src/egg.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/koa-static-cache/tsdown.config.tspackages/extend2/tsdown.config.tsplugins/typebox-validate/src/app/extend/context.tsplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tsplugins/typebox-validate/src/decorator.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tspackages/cookies/tsdown.config.tsplugins/typebox-validate/src/types.ts
{packages,plugins,tools}/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
Each package should include tsdown.config.ts for unbundled ESM builds
Files:
packages/core/tsdown.config.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/koa-static-cache/tsdown.config.tspackages/extend2/tsdown.config.tsplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tspackages/cookies/tsdown.config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Enable TypeScript strict mode in all TypeScript packages
Use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes
Use readonly modifiers where appropriate
Avoid the any type; use unknown when the type is truly unknown
Files:
packages/core/tsdown.config.tspackages/core/src/egg.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/koa-static-cache/tsdown.config.tspackages/extend2/tsdown.config.tsplugins/typebox-validate/src/app/extend/context.tsplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tsplugins/typebox-validate/src/decorator.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tsplugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tspackages/cookies/tsdown.config.tsplugins/typebox-validate/src/types.ts
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use TypeScript for all source files in packages (no JavaScript source files)
Files:
packages/core/src/egg.ts
{package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")
Files:
plugins/static/package.jsonplugins/watcher/package.jsonpackages/egg/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonpackages/koa/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonpackages/router/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.jsonplugins/typebox-validate/package.json
plugins/**/package.json
📄 CodeRabbit inference engine (CLAUDE.md)
plugins/**/package.json: All plugins must include egg as a peerDependency with version "workspace:"
Plugin package.json exports must map TypeScript sources for dev and mirror them under publishConfig.exports to dist/.js for publish
All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
Files:
plugins/static/package.jsonplugins/watcher/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.jsonplugins/typebox-validate/package.json
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
{packages/**/package.json,plugins/**/package.json,tools/**/package.json}: All packages must include a typecheck script running "tsc --noEmit"
All packages must use oxlint for linting with "lint": "oxlint --type-aware" and provide "lint:fix"
Files:
plugins/static/package.jsonplugins/watcher/package.jsonpackages/egg/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonpackages/koa/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonpackages/router/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.jsonplugins/typebox-validate/package.json
{pnpm-workspace.yaml,packages/**/package.json,plugins/**/package.json,tools/**/package.json}
📄 CodeRabbit inference engine (CLAUDE.md)
Use pnpm catalog mode: external deps referenced as "catalog:" and kept in pnpm-workspace.yaml catalog
Files:
plugins/static/package.jsonplugins/watcher/package.jsonpackages/egg/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonpackages/koa/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonpackages/router/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.jsonplugins/typebox-validate/package.json
packages/*/package.json
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use "workspace:*" for internal workspace dependencies in package.json
Files:
packages/egg/package.jsonpackages/koa/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonpackages/router/package.json
plugins/**/tsdown.config.ts
📄 CodeRabbit inference engine (CLAUDE.md)
All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unused.level: 'error', dts: true, exports.devExports: true)
Files:
plugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.ts
**/test/fixtures/**
📄 CodeRabbit inference engine (AGENTS.md)
Put reusable test data under test/fixtures/
Files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
plugins/**/src/types.ts
📄 CodeRabbit inference engine (CLAUDE.md)
All plugins must define src/types.ts that augments the 'egg' module and uses .ts extensions in relative type imports
Files:
plugins/typebox-validate/src/types.ts
🧠 Learnings (14)
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsconfig.json : All sub-project tsconfig.json files must extend the root config using "extends": "../../tsconfig.json" and include "compilerOptions.baseUrl": "./"
Applied to files:
plugins/onerror/tsconfig.jsonpackages/cluster/tsconfig.jsonplugins/logrotator/tsconfig.build.jsonplugins/logrotator/tsconfig.jsonpackages/core/tsconfig.build.jsonplugins/security/tsconfig.build.jsonpackages/supertest/tsconfig.build.jsonpackages/koa/tsconfig.jsonpackages/utils/tsconfig.build.jsonplugins/session/tsconfig.jsonplugins/typebox-validate/tsconfig.build.jsonplugins/watcher/tsconfig.build.jsonplugins/development/tsconfig.build.jsonpackages/koa-static-cache/tsconfig.jsonplugins/multipart/tsconfig.jsonplugins/static/tsconfig.build.jsonplugins/view/tsconfig.build.jsonpackages/cookies/tsconfig.build.jsonpackages/extend2/tsconfig.build.jsonplugins/tracer/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/i18n/tsconfig.jsonpackages/core/tsconfig.jsonpackages/router/tsconfig.jsonplugins/schedule/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/tsdown.config.ts : All plugins must use the standard tsdown configuration template (entry: 'src/**/*.ts', unused.level: 'error', dts: true, exports.devExports: true)
Applied to files:
plugins/onerror/tsconfig.jsonpackages/core/tsdown.config.tsplugins/logrotator/tsconfig.build.jsonpackages/router/tsdown.config.tsplugins/security/tsconfig.build.jsonpackages/supertest/tsconfig.build.jsonpackages/supertest/tsdown.config.tspackages/koa-static-cache/tsdown.config.tspackages/utils/tsconfig.build.jsonplugins/typebox-validate/tsconfig.build.jsonplugins/watcher/tsconfig.build.jsonpackages/extend2/tsdown.config.tsplugins/development/tsconfig.build.jsonplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/multipart/tsconfig.jsonplugins/jsonp/tsdown.config.tsplugins/static/tsconfig.build.jsonplugins/onerror/tsdown.config.tsplugins/view/tsconfig.build.jsonpackages/cookies/tsconfig.build.jsonpackages/extend2/tsconfig.build.jsonpackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tspackages/cookies/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"
Applied to files:
plugins/onerror/tsconfig.jsonpackages/cluster/tsconfig.jsonplugins/logrotator/tsconfig.build.jsonplugins/logrotator/tsconfig.jsonpackages/core/tsconfig.build.jsonplugins/security/tsconfig.build.jsonpackages/supertest/tsconfig.build.jsonpackages/koa/tsconfig.jsonpackages/utils/tsconfig.build.jsonplugins/session/tsconfig.jsonplugins/typebox-validate/tsconfig.build.jsonplugins/watcher/tsconfig.build.jsonplugins/development/tsconfig.build.jsonpackages/koa-static-cache/tsconfig.jsonplugins/multipart/tsconfig.jsonplugins/static/tsconfig.build.jsonplugins/view/tsconfig.build.jsonpackages/cookies/tsconfig.build.jsonpackages/extend2/tsconfig.build.jsonplugins/tracer/tsconfig.jsonpackages/cookies/tsconfig.jsonplugins/i18n/tsconfig.jsonpackages/core/tsconfig.jsonpackages/router/tsconfig.jsonplugins/schedule/tsconfig.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages,plugins,tools}/**/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds
Applied to files:
packages/core/tsdown.config.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/extend2/tsdown.config.tsplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tspackages/cookies/tsdown.config.ts
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Applies to packages/*/tsdown.config.ts : Each package must provide a tsdown.config.ts for unbundled ESM builds
Applied to files:
packages/core/tsdown.config.tspackages/router/tsdown.config.tspackages/supertest/tsdown.config.tspackages/extend2/tsdown.config.tsplugins/mock/tsdown.config.tsplugins/multipart/tsdown.config.tsplugins/schedule/tsdown.config.tsplugins/jsonp/tsdown.config.tsplugins/onerror/tsdown.config.tspackages/cluster/tsdown.config.tspackages/koa/tsdown.config.tspackages/utils/tsdown.config.tsplugins/tracer/tsdown.config.tsplugins/i18n/tsdown.config.tsplugins/logrotator/tsdown.config.tsplugins/session/tsdown.config.tsplugins/development/tsdown.config.tsplugins/static/tsdown.config.tspackages/cookies/tsdown.config.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/package.json : All plugins must include scripts: build (tsdown), clean (rimraf dist), typecheck (tsc --noEmit), lint (oxlint --type-aware), lint:fix, test (lint:fix && vitest), prepublishOnly (build)
Applied to files:
plugins/static/package.jsonplugins/watcher/package.jsonpackages/egg/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonpackages/koa/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonpackages/router/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/**/package.json,plugins/**/package.json,tools/**/package.json} : All packages must include a typecheck script running "tsc --noEmit"
Applied to files:
plugins/static/package.jsonpackages/egg/package.jsonplugins/tracer/package.jsonplugins/view/package.jsonpackages/core/package.jsonpackages/extend2/package.jsonplugins/i18n/package.jsonplugins/mock/package.jsonplugins/onerror/package.jsonpackages/utils/package.jsonpackages/koa-static-cache/package.jsonpackages/supertest/package.jsonplugins/multipart/package.jsonplugins/logrotator/package.jsonplugins/security/package.jsonplugins/development/package.jsonplugins/schedule/package.jsonplugins/session/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/!(cookies)/**/vitest.config.ts,tools/!(egg-bin)/**/vitest.config.ts,plugins/**/vitest.config.ts} : All packages (except cookies and egg-bin) must include a vitest.config.ts for tests
Applied to files:
packages/supertest/tsconfig.build.jsonpackages/cookies/tsconfig.build.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/!(cookies)/**/test/**/*.test.ts,tools/!(egg-bin)/**/test/**/*.test.ts,plugins/**/test/**/*.test.ts} : Vitest-based packages should write tests under test/**/*.test.ts and import test utilities from 'vitest'
Applied to files:
packages/supertest/tsconfig.build.jsonplugins/logrotator/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to plugins/**/src/types.ts : All plugins must define src/types.ts that augments the 'egg' module and uses .ts extensions in relative type imports
Applied to files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.tsplugins/typebox-validate/src/types.tsplugins/typebox-validate/package.json
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/egg/src/config/plugin.ts} : Built-in plugin configurations must be defined in packages/egg/src/config/plugin.ts
Applied to files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {packages/egg/src/config/config.default.ts,packages/egg/src/config/plugin.ts} : Default framework configuration and built-in plugin list must be maintained in their respective config files
Applied to files:
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
📚 Learning: 2025-10-04T16:04:36.436Z
Learnt from: CR
PR: eggjs/egg#0
File: CLAUDE.md:0-0
Timestamp: 2025-10-04T16:04:36.436Z
Learning: Applies to {package.json,packages/**/package.json,plugins/**/package.json,tools/**/package.json} : All packages must require Node.js >= 22.18.0 (set engines.node to ">=22.18.0")
Applied to files:
plugins/typebox-validate/package.json
📚 Learning: 2025-09-14T08:41:30.618Z
Learnt from: CR
PR: eggjs/egg#0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-09-14T08:41:30.618Z
Learning: Require Node.js version >= 20.19.0 for all development and CI environments
Applied to files:
plugins/typebox-validate/package.json
🧬 Code graph analysis (1)
plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts (1)
packages/egg/src/lib/types.ts (1)
EggPlugin(314-328)
⏰ 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). (15)
- GitHub Check: Socket Security: Pull Request Alerts
- GitHub Check: Test (ubuntu-latest, 24, plugins)
- GitHub Check: Test (windows-latest, 22, packages)
- GitHub Check: Test (windows-latest, 24, packages)
- GitHub Check: Test (macos-latest, 22, plugins)
- GitHub Check: Test (ubuntu-latest, 24, packages)
- GitHub Check: Test (windows-latest, 22, plugins)
- GitHub Check: Test (macos-latest, 22, packages)
- GitHub Check: Test (ubuntu-latest, 22, packages)
- GitHub Check: Test (ubuntu-latest, 22, plugins)
- GitHub Check: Test (windows-latest, 24, plugins)
- GitHub Check: Test (macos-latest, 24, plugins)
- GitHub Check: Test (macos-latest, 24, packages)
- GitHub Check: Test egg-bin (windows-latest, 22)
- GitHub Check: Test egg-bin (ubuntu-latest, 22)
🔇 Additional comments (37)
plugins/session/tsconfig.json (1)
2-5: Config matches monorepo standard.
extendsandcompilerOptions.baseUrlfollow the required pattern for plugin tsconfigs. No further changes needed.packages/router/tsconfig.json (1)
4-5: Configuration aligns with monorepo guidelines.
baseUrlis set locally while the rest inherits from the root config—exactly what we want here.plugins/multipart/tsconfig.json (1)
4-5: Config matches the monorepo rule.
baseUrlis correctly set alongside the shared extends path, so this sub-project stays compliant. Based on learningspackages/core/tsconfig.json (1)
4-5: Base URL configuration looks good.Keeping
baseUrl: "./"here meets the CLAUDE.md guidance for package tsconfigs.packages/core/tsconfig.build.json (1)
1-9: Build config aligns with the new per-package pattern.Extending
./tsconfig.jsonand scopingrootDir/outDirhere matches the monorepo build strategy, and the exclude set keeps artifacts/config out of the build.packages/cluster/tsconfig.json (1)
4-5: Configuration complies with shared TS config requirements.Extends the root tsconfig and retains the mandated local
baseUrl, matching the monorepo pattern.As per coding guidelines
plugins/i18n/tsdown.config.ts (1)
5-5: LGTM! Aligns with repository standards.Enabling
unbundle: trueproperly implements the unbundled ESM build requirement for plugins, as specified in the coding guidelines. The configuration matches the standard template (entry, unused.level, dts, exports.devExports) and is consistent with the broader monorepo standardization in this PR.plugins/jsonp/tsdown.config.ts (1)
3-13: LGTM! Aligns with monorepo unbundled ESM builds standard.Enabling
unbundle: trueis consistent with the standardization effort across other plugins (koa, router, supertest) and aligns with the coding guideline requirement for unbundled ESM builds. The configuration matches the standard template with all required properties present.packages/extend2/tsdown.config.ts (1)
7-7: LGTM! Enabling unbundling aligns with library best practices.Enabling
unbundle: trueis the correct approach for library packages, as it prevents dependency duplication and allows consumers to handle tree-shaking and deduplication. This change aligns with the repository's standardization effort across packages.Based on learnings.
packages/utils/tsdown.config.ts (1)
7-7: LGTM! Unbundling activated for utils package.Enabling
unbundle: trueis the correct configuration for packages in this monorepo, ensuring unbundled ESM builds while preserving the original module structure.Based on learnings
plugins/mock/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds across packages and plugins.plugins/schedule/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.packages/cluster/tsdown.config.ts (1)
9-9: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.packages/supertest/tsdown.config.ts (1)
7-7: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.packages/core/tsdown.config.ts (1)
7-7: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.packages/cookies/tsconfig.build.json (1)
1-9: LGTM! Standard build configuration.The new
tsconfig.build.jsonfollows the repository pattern for build-specific TypeScript configurations, appropriately extending the localtsconfig.jsonand defining build-specific compiler options and exclusions.packages/cookies/tsdown.config.ts (1)
7-7: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.packages/koa/tsdown.config.ts (1)
7-7: LGTM! Unbundling enabled consistently.The addition of
unbundle: truealigns with the repository-wide pattern of enabling unbundled ESM builds.plugins/development/tsconfig.build.json (1)
1-9: LGTM! Build configuration follows repository pattern.The tsconfig.build.json correctly extends the local tsconfig.json and defines appropriate compiler options for build output. The exclusions properly omit test files, build artifacts, and configuration files.
plugins/static/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled as per repository-wide pattern.The configuration correctly enables unbundling while maintaining all required standard template properties for plugins.
plugins/static/tsconfig.build.json (1)
1-9: LGTM! Build configuration follows repository pattern.The tsconfig.build.json is consistent with other plugin build configurations and correctly defines compilation options for the static plugin.
packages/koa-static-cache/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled for package build.The unbundle option is correctly enabled, aligning with the repository-wide build configuration pattern.
plugins/development/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled as per standard plugin configuration.The change correctly enables unbundling while maintaining compliance with the standard tsdown template for plugins.
plugins/onerror/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled with proper file copy configuration.The unbundle option is correctly activated, and the configuration maintains the standard plugin template while including the necessary file copy directive for the mustache template.
plugins/tracer/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled per repository-wide configuration.The configuration correctly enables unbundling while adhering to the standard plugin template requirements.
plugins/multipart/tsdown.config.ts (1)
5-5: LGTM! Unbundling enabled following standard configuration.The change properly activates unbundling in alignment with the repository-wide build configuration updates while maintaining the standard plugin template.
plugins/onerror/tsconfig.json (1)
2-5: LGTM! Configuration follows monorepo standards.The simplified tsconfig correctly extends the root configuration and includes the required
baseUrlsetting. The separation of build-specific options intotsconfig.build.jsonis a good practice.As per coding guidelines.
packages/router/package.json (1)
50-50: LGTM! Build script updated for dedicated build configuration.The build script now uses
tsconfig.build.jsonand properly cleans up TypeScript build artifacts including*.tsbuildinfofiles. This aligns with the repository-wide standardization effort.packages/router/tsdown.config.ts (1)
5-5: LGTM! Unbundled build mode enabled.Enabling
unbundle: truealigns with the monorepo's move toward unbundled ESM builds, consistent with similar changes across other packages in this PR.plugins/onerror/package.json (1)
60-60: LGTM! Build script standardized.The build script update follows the same pattern as other packages, using
tsconfig.build.jsonand cleaning*.tsbuildinfofiles. The mustache template copy step is correctly preserved.Note: The plugin is missing some scripts recommended by coding guidelines (
clean,lint:fixas separate scripts, andtestshould runlint:fix && vitest), but these are pre-existing and not introduced by this change.plugins/schedule/package.json (1)
71-71: Build script update aligns with repo standard.Nice catch adding the
*.tsbuildinfocleanup and switching to the dedicatedtsconfig.build.json; this mirrors the monorepo build flow and keeps caching artifacts tidy.packages/core/src/egg.ts (1)
47-47: LGTM! Type narrowing for Egg's Context.This declaration correctly narrows the
ctxtype from Koa's genericKoaContextto Egg's extendedContexttype, which is a standard pattern when extending Koa's type system. The circular reference betweenRequest.ctxandContext.requestis intentional and safe as these are type-only declarations.plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts (1)
1-10: LGTM! Standard plugin configuration.The test fixture plugin configuration correctly follows Egg.js conventions, properly imports the
EggPlugintype, and enables the@eggjs/typebox-validateplugin. This aligns with the PR's goal of integrating the typebox-validate plugin into the monorepo.plugins/typebox-validate/src/app/extend/context.ts (1)
25-30: LGTM! Module augmentation follows plugin guidelines.The module augmentation correctly extends the
Contextinterface with validation methods, matching the implementation signatures. This follows the coding guideline that all plugins must augment the 'egg' module.Based on coding guidelines.
plugins/typebox-validate/src/types.ts (1)
1-3: LGTM! Correct plugin type orchestration.This file properly orchestrates type augmentations using side-effect imports with
.tsextensions, following the coding guideline that all plugins must definesrc/types.tswith.tsextensions in relative type imports. The imports ensure the config augmentation, app augmentation, and context extensions are loaded correctly.Based on coding guidelines and learnings.
plugins/typebox-validate/src/decorator.ts (2)
1-8: LGTM! Well-structured validation rule types.The type definitions are clean and purposeful. The
ValidateRuletuple type clearly groups the schema, data extractor, and optional custom error formatter, providing flexibility for different validation scenarios.
10-31: LGTM! Decorator implementation is correct.The
ValidateFactoryimplementation correctly:
- Preserves the
thiscontext usingfn.apply(this, args)(line 26)- Uses
ctx.tValidateWithoutThrowto avoid nested throw logic (line 21)- Handles both synchronous and asynchronous methods with the async wrapper
- Validates all rules before executing the original method
The decorator pattern is well-implemented and type-safe.
| "description": "A core plugin framework based on @eggjs/koa", | ||
| "scripts": { | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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 build order so tsdown output isn’t wiped.
tsdown populates dist, but the following rimraf dist *.tsbuildinfo deletes it before tsc -p … runs, so the bundle is lost. Clean first, then build:
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In packages/core/package.json around line 27, the npm script runs tsdown then
rimraf which deletes the dist output; change the order so cleanup runs first
(rimraf dist *.tsbuildinfo) and then run tsdown followed by tsc -p
tsconfig.build.json so the tsdown output is not removed before compilation.
| "lint": "oxlint", | ||
| "typecheck": "tsc --noEmit", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc && cp src/config/favicon.png dist/config/favicon.png", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json && cp src/config/favicon.png dist/config/favicon.png", |
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.
Reorder the build steps to avoid deleting tsdown output.
tsdown writes its bundle to dist, but the subsequent rimraf dist *.tsbuildinfo wipes that directory before tsc -p … runs, so the bundle you just produced never ships. Clean first, then build:
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json && cp src/config/favicon.png dist/config/favicon.png",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json && cp src/config/favicon.png dist/config/favicon.png",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json && cp src/config/favicon.png dist/config/favicon.png", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json && cp src/config/favicon.png dist/config/favicon.png", |
🤖 Prompt for AI Agents
In packages/egg/package.json around line 175, the npm "build" script runs tsdown
before cleaning, which causes the tsdown output in dist to be removed by the
subsequent rimraf; reorder the commands so the cleaning (rimraf dist
*.tsbuildinfo) runs first, then run tsdown, then tsc -p tsconfig.build.json, and
finally copy the favicon to dist/config/favicon.png to ensure the tsdown bundle
is preserved and the build artifacts are produced in the cleaned dist.
| }, | ||
| "scripts": { | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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.
Reorder the build script to avoid deleting fresh artifacts.
Running rimraf dist *.tsbuildinfo after tsdown wipes the bundle that tsdown just produced, so the published package will miss those files. Clean first, then build—e.g. rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json.
🤖 Prompt for AI Agents
In packages/koa-static-cache/package.json at line 50, the build script runs
tsdown before rimraf which deletes artifacts tsdown just produced; change the
command order so cleanup runs first (remove dist and .tsbuildinfo), then run
tsdown and finally tsc -p tsconfig.build.json to produce the distribution files
in the correct order.
| "description": "Koa web app framework for https://eggjs.org", | ||
| "scripts": { | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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 the build order before it ships an empty package.
Running rimraf dist *.tsbuildinfo after tsdown deletes the freshly built bundle, so pnpm run build leaves dist/ with only whatever tsc -p tsconfig.build.json emits (often just declarations). The published package will miss its runtime JS. Move the cleanup ahead of both build steps.
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In packages/koa/package.json around line 27, the "build" script currently runs
tsdown then deletes dist and tsbuildinfo which removes the freshly produced
bundle; update the script so the rimraf cleanup runs first (remove dist and
*.tsbuildinfo), then run tsdown and finally tsc -p tsconfig.build.json to ensure
the runtime JS produced by tsdown is preserved and the final TypeScript compile
runs after cleanup.
| }, | ||
| "scripts": { | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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 build script order—clean must happen before building.
tsdown runs first, then rimraf dist *.tsbuildinfo immediately deletes everything it just emitted, so the published package will miss the bundled output. Clean before invoking the builders instead:
-"build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+"build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In packages/supertest/package.json around line 58, the "build" script currently
runs "tsdown" before the cleanup which causes the freshly generated output to be
deleted; change the script to perform the cleanup first (run rimraf dist
*.tsbuildinfo), then run the builders (tsdown && tsc -p tsconfig.build.json) so
artifacts are cleaned before being created and the published package includes
the bundled output.
| }, | ||
| "scripts": { | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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.
Clean before building so the tsdown artifacts survive.
Running tsdown and then immediately rimraf dist *.tsbuildinfo deletes the freshly generated bundle. Flip the order so you clean first and then build:
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In plugins/static/package.json at line 60, the build script runs tsdown before
rimraf which deletes the newly generated artifacts; change the command order so
cleanup runs first (rimraf dist *.tsbuildinfo) and then run tsdown and tsc, e.g.
run rimraf before tsdown && tsc -p tsconfig.build.json so the tsdown output is
not removed.
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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.
Reorder the build steps to avoid deleting the tsdown output.
Currently tsdown runs first, but then rimraf dist ... immediately deletes everything it just generated, so only the subsequent tsc artifacts survive. That drops tsdown’s bundled results from the published package. Clean before building to keep both outputs.
Apply this fix:
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In plugins/tracer/package.json around line 62, the build script runs "tsdown"
before the "rimraf" clean step which deletes tsdown's output; reorder the steps
so cleanup runs first. Update the build script to run the rimraf clean (rimraf
dist *.tsbuildinfo) before invoking tsdown and then tsc, ensuring both tsdown
and tsc artifacts are preserved and published.
| "scripts": { | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | ||
| "clean": "rimraf dist", | ||
| "typecheck": "tsc --noEmit", | ||
| "lint": "oxlint --type-aware", | ||
| "test": "vitest run", | ||
| "prepublishOnly": "pnpm run build" | ||
| }, |
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.
Align scripts with required lint workflow.
Per the plugin scripting standard we need a lint:fix target and test must chain lint:fix && vitest. Please add the fixer and update the test script accordingly.
- "lint": "oxlint --type-aware",
- "test": "vitest run",
+ "lint": "oxlint --type-aware",
+ "lint:fix": "oxlint --type-aware --fix",
+ "test": "pnpm run lint:fix && vitest run",As per coding guidelines
📝 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.
| "scripts": { | |
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "clean": "rimraf dist", | |
| "typecheck": "tsc --noEmit", | |
| "lint": "oxlint --type-aware", | |
| "test": "vitest run", | |
| "prepublishOnly": "pnpm run build" | |
| }, | |
| "scripts": { | |
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "clean": "rimraf dist", | |
| "typecheck": "tsc --noEmit", | |
| "lint": "oxlint --type-aware", | |
| "lint:fix": "oxlint --type-aware --fix", | |
| "test": "pnpm run lint:fix && vitest run", | |
| "prepublishOnly": "pnpm run build" | |
| }, |
🤖 Prompt for AI Agents
In plugins/typebox-validate/package.json around lines 58 to 65, the package.json
lacks a lint:fix script and the test script doesn't run the linter fixer first;
add a "lint:fix" script that runs the same linter command with the fixer flag
(e.g., oxlint --type-aware --fix) and update the "test" script to chain the
fixer before tests (run lint:fix then vitest) so tests always run after
automatic lint fixes.
Restore tsdown output before publish.
build runs tsdown and then immediately deletes dist, so the bundler's JS artifacts are gone by the time tsc runs. The published package would therefore miss the JS files your publishConfig.exports expect. Flip the cleanup to happen before generation.
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",As per coding guidelines
📝 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.
| "scripts": { | |
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "clean": "rimraf dist", | |
| "typecheck": "tsc --noEmit", | |
| "lint": "oxlint --type-aware", | |
| "test": "vitest run", | |
| "prepublishOnly": "pnpm run build" | |
| }, | |
| "scripts": { | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", | |
| "clean": "rimraf dist", | |
| "typecheck": "tsc --noEmit", | |
| "lint": "oxlint --type-aware", | |
| "test": "vitest run", | |
| "prepublishOnly": "pnpm run build" | |
| }, |
🤖 Prompt for AI Agents
In plugins/typebox-validate/package.json around lines 58–65, the "build" script
currently runs tsdown and then deletes dist, which removes the generated JS
before tsc runs; update the build script to perform the rimraf cleanup (dist and
*.tsbuildinfo) before running tsdown and tsc so that generated JS artifacts
remain available for packaging.
| "typecheck": "tsc --noEmit", | ||
| "test": "vitest run", | ||
| "build": "tsdown && rimraf dist && tsc -b --clean && tsc", | ||
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", |
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 build cleanup order
Running rimraf dist after tsdown wipes all artifacts that tsdown just produced, so the published package loses those bundles. Clean first, then build.
-"build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+"build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", |
🤖 Prompt for AI Agents
In plugins/view/package.json around line 79, the build script runs cleanup after
tsdown which deletes artifacts just produced; change the command order so
cleanup runs first (remove dist and *.tsbuildinfo before running tsdown and
tsc). Update the "build" script to call rimraf (and any other cleanup) before
invoking tsdown and then tsc -p tsconfig.build.json so generated bundles are
preserved for publishing.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | ||
| "prepublishOnly": "pnpm run build" |
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 the build script sequencing
Running tsdown before rimraf dist *.tsbuildinfo wipes everything tsdown just emitted, so the final dist/ only contains the plain tsc output. That breaks the bundled artifacts we rely on for publish. Clean first, then build.
- "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
+ "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json",📝 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.
| "build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json", | |
| "prepublishOnly": "pnpm run build" | |
| "build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json", | |
| "prepublishOnly": "pnpm run build" |
🤖 Prompt for AI Agents
In plugins/watcher/package.json around lines 32 to 33, the build script runs
tsdown before the cleanup so the cleanup step deletes the emitted tsdown
artifacts; change the sequencing so cleanup runs first (rimraf dist
*.tsbuildinfo) and then run tsdown and tsc -p tsconfig.build.json (e.g.,
"build": "rimraf dist *.tsbuildinfo && tsdown && tsc -p tsconfig.build.json") so
the emitted bundled artifacts from tsdown are preserved for publish.
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: 0
♻️ Duplicate comments (1)
plugins/typebox-validate/src/app/extend/context.ts (1)
13-13: Conditional schema stringification is still pending.The TODO comment and past review both flag this: stringifying large schemas on every validation failure in production can spike CPU usage and log volume.
Apply this diff to conditionally stringify based on environment:
- currentSchema: JSON.stringify(schema), + currentSchema: this.app.config.env !== 'prod' ? JSON.stringify(schema) : undefined,
🧹 Nitpick comments (1)
plugins/typebox-validate/src/app/extend/context.ts (1)
20-23: Consider returning validation errors for better ergonomics.The method returns only a boolean, requiring callers to separately access
ctx.app.ajv.errorsimmediately after a failed validation. While this follows AJV's standard pattern, a more ergonomic API could return both the result and errors together.Example refactor (if you want to improve the API):
- tValidateWithoutThrow(schema: Schema, data: unknown): boolean { - const res = this.app.ajv.validate(schema, data); - return res; + tValidateWithoutThrow(schema: Schema, data: unknown): { valid: boolean; errors: typeof this.app.ajv.errors } { + const valid = this.app.ajv.validate(schema, data); + return { valid, errors: this.app.ajv.errors }; }Then update the module augmentation accordingly. (This is optional; the current pattern is standard AJV usage.)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
plugins/typebox-validate/src/app/extend/context.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
**/*.ts: Prefer TypeScript and ESM: write sources and exports in .ts (ESM-first) rather than CommonJS
Use two-space indentation, trailing commas, and semicolons (Prettier/oxlint defaults)
Name files in lowercase with hyphens (e.g., loader-context.ts)
Name classes in PascalCase
Name functions and variables in camelCase
Re-export types thoughtfully to keep the public API stable
Files:
plugins/typebox-validate/src/app/extend/context.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Enable TypeScript strict mode in all TypeScript packages
Use explicit return types for public APIs
Prefer interfaces over type aliases for object shapes
Use readonly modifiers where appropriate
Avoid the any type; use unknown when the type is truly unknown
Files:
plugins/typebox-validate/src/app/extend/context.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). (14)
- GitHub Check: Test (macos-latest, 24, plugins)
- GitHub Check: Test (macos-latest, 22, plugins)
- GitHub Check: Test (windows-latest, 24, plugins)
- GitHub Check: Test (ubuntu-latest, 22, plugins)
- GitHub Check: Test (windows-latest, 22, plugins)
- GitHub Check: Test (macos-latest, 22, packages)
- GitHub Check: Test (ubuntu-latest, 24, plugins)
- GitHub Check: Test (ubuntu-latest, 24, packages)
- GitHub Check: Test (macos-latest, 24, packages)
- GitHub Check: Test (ubuntu-latest, 22, packages)
- GitHub Check: Test (windows-latest, 24, packages)
- GitHub Check: Test (windows-latest, 22, packages)
- GitHub Check: Test egg-bin (ubuntu-latest, 22)
- GitHub Check: Test egg-bin (windows-latest, 22)

🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation
Tests
Chores