Skip to content

Conversation

@fengmk2
Copy link
Member

@fengmk2 fengmk2 commented Oct 5, 2025

  • 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

Summary by CodeRabbit

  • New Features

    • Added @eggjs/typebox-validate plugin: TypeBox/AJV validation, ctx.tValidate/ctx.tValidateWithoutThrow helpers, and a @Validate decorator for controllers/services.
    • Request objects now expose ctx for easier context access.
  • Documentation

    • Added comprehensive Chinese README for @eggjs/typebox-validate.
    • Updated plugin listing in CLAUDE.md.
  • Tests

    • Added test fixtures and a comprehensive test suite for the new plugin.
  • Chores

    • Standardized build configs/scripts, added tsconfig.build.json files, enabled unbundling, updated workspace dependencies, and removed a release workflow build step.

- 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>
@fengmk2 fengmk2 requested a review from Copilot October 5, 2025 04:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 5, 2025

Note

Other AI code review bot(s) detected

CodeRabbit 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.

Walkthrough

Adds 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

Cohort / File(s) Summary
New plugin: typebox-validate
plugins/typebox-validate/* (LICENSE, README.md, package.json, src/..., test/..., tsconfig*.json, tsdown.config.ts, vitest.config.ts)
Adds plugin implementing AJV boot hook (app.ts), app.ajv, ctx extensions (tValidate, tValidateWithoutThrow), config typing/patch hook, decorator API, TypeBox and Ajv re-exports, tests/fixtures, docs, and package build/test config.
Docs update
CLAUDE.md
Adds plugin entry under tracer plugin section.
Core public API
packages/core/src/egg.ts
Adds public property Request.ctx: Context.
Release workflow
.github/workflows/release.yml
Removes "Build packages" step from release workflow.
Workspace / deps
pnpm-workspace.yaml
Adds catalog entries for @sinclair/typebox, ajv, ajv-formats, ajv-keywords.
TS project references
tsconfig.json
Adds project reference to ./plugins/typebox-validate.
Build scripts -> tsconfig.build.json
packages/*/package.json, plugins/*/package.json (many)
Standardizes build scripts: remove dist and *.tsbuildinfo, run tsc -p tsconfig.build.json; some packages add test/ci/prepublish scripts.
Per-package build configs
packages/*/tsconfig.build.json, plugins/*/tsconfig.build.json (many)
Adds per-package tsconfig.build.json (baseUrl, rootDir=./src, outDir=./dist, excludes).
Trim base tsconfigs
packages/*/tsconfig.json, plugins/*/tsconfig.json (many)
Remove local rootDir, outDir, and broad exclude entries; retain baseUrl.
Enable tsdown unbundle
packages/*/tsdown.config.ts, plugins/*/tsdown.config.ts (many)
Activates previously commented unbundle: true across multiple tsdown configs.
Tests / fixtures
plugins/typebox-validate/test/**, plugins/*/test/*
Adds plugin test suite and fixtures; minor test guards/typing adjustments (skip-on-win, type-only imports).
Small import/type tweaks
packages/core/example/middleware/hello.ts, plugins/tracer/test/*.test.ts, others
Minor import path/type-only import 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
Loading
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
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

Poem

A rabbit hops with schemas bright,
AJV lanterns glow through night.
TypeBox snug, decorators tight,
Tests all pass, configs take flight.
New plugin burrows — cozy, right? 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title concisely and accurately describes the primary change of merging the egg-typebox-validate plugin into the monorepo, uses a clear conventional-commit style prefix, and focuses on the main objective without unnecessary detail.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch egg-typebox-validate

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e93a37f and 614aca0.

📒 Files selected for processing (14)
  • packages/core/tsconfig.json (1 hunks)
  • packages/egg/tsconfig.json (1 hunks)
  • packages/utils/test/fixtures/ts-module/package.json (1 hunks)
  • plugins/mock/tsconfig.json (1 hunks)
  • plugins/security/test/csp.test.ts (1 hunks)
  • plugins/security/test/xss.test.ts (1 hunks)
  • plugins/security/tsdown.config.ts (1 hunks)
  • plugins/tracer/test/error.tracer.test.ts (1 hunks)
  • plugins/tracer/test/tracer.test.ts (1 hunks)
  • plugins/typebox-validate/README.md (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts (1 hunks)
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts (1 hunks)
  • plugins/view/tsdown.config.ts (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/utils/test/fixtures/ts-module/package.json
  • plugins/typebox-validate/README.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/tsconfig.json
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts
🧰 Additional context used
📓 Path-based instructions (10)
**/*.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/security/test/csp.test.ts
  • plugins/view/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/security/test/xss.test.ts
  • plugins/security/tsdown.config.ts
  • plugins/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.test.ts
**/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 suites

Test files must follow the naming pattern test/**/*.test.ts

Files:

  • plugins/security/test/csp.test.ts
  • plugins/security/test/xss.test.ts
  • plugins/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.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/security/test/csp.test.ts
  • plugins/security/test/xss.test.ts
  • plugins/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.test.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/security/test/csp.test.ts
  • plugins/view/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/security/test/xss.test.ts
  • plugins/security/tsdown.config.ts
  • plugins/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.test.ts
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/egg/tsconfig.json
{tsconfig.json,packages/*/tsconfig.json}

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

Enable strict TypeScript mode across all packages

Files:

  • packages/egg/tsconfig.json
{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:

  • packages/egg/tsconfig.json
  • plugins/mock/tsconfig.json
{packages,plugins,tools}/**/tsdown.config.ts

📄 CodeRabbit inference engine (CLAUDE.md)

Each package should include tsdown.config.ts for unbundled ESM builds

Files:

  • plugins/view/tsdown.config.ts
  • plugins/security/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/view/tsdown.config.ts
  • plugins/security/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/app/controller/home.ts
🧠 Learnings (9)
📓 Common learnings
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 egg as a peerDependency with version "workspace:*"
📚 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:

  • packages/egg/tsconfig.json
  • plugins/mock/tsconfig.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: Applies to packages/*/tsconfig.json : All sub-project tsconfig.json files must extend from the root via "extends": "../../tsconfig.json"

Applied to files:

  • packages/egg/tsconfig.json
  • plugins/mock/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/!(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/egg/tsconfig.json
  • plugins/mock/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:

  • packages/egg/tsconfig.json
  • plugins/view/tsdown.config.ts
  • plugins/mock/tsconfig.json
  • plugins/security/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 {packages,plugins,tools}/**/tsdown.config.ts : Each package should include tsdown.config.ts for unbundled ESM builds

Applied to files:

  • plugins/view/tsdown.config.ts
  • plugins/security/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/view/tsdown.config.ts
  • plugins/security/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 {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/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.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/tracer/test/error.tracer.test.ts
  • plugins/tracer/test/tracer.test.ts
🧬 Code graph analysis (1)
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)
⏰ 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)
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: Test (windows-latest, 22, packages)
  • GitHub Check: Test (windows-latest, 24, plugins)
  • GitHub Check: Test (macos-latest, 24, packages)
  • GitHub Check: Test (windows-latest, 24, packages)
  • GitHub Check: Test (macos-latest, 24, tools)
  • GitHub Check: Test (macos-latest, 24, plugins)
  • GitHub Check: Test (ubuntu-latest, 22, plugins)
  • GitHub Check: Test (ubuntu-latest, 24, plugins)
  • GitHub Check: Test (macos-latest, 22, plugins)
  • 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, 24, packages)
  • GitHub Check: Test egg-bin (ubuntu-latest, 22)
  • GitHub Check: Test egg-bin (windows-latest, 22)
  • GitHub Check: typecheck
  • GitHub Check: Cloudflare Pages: egg-v3
🔇 Additional comments (9)
packages/egg/tsconfig.json (1)

4-6: Config matches monorepo expectations.

Retaining baseUrl and narrowing the exclusion list keeps the package compliant with our shared TypeScript setup. Nicely aligned with the documented pattern.

plugins/security/tsdown.config.ts (1)

5-5: LGTM! Unbundling enabled correctly.

The activation of unbundle: true aligns with the PR objective to enable unbundled ESM builds across all plugins. The configuration matches the standard template as per coding guidelines.

plugins/view/tsdown.config.ts (1)

5-5: LGTM! Unbundling enabled correctly.

The activation of unbundle: true aligns with the PR objective to enable unbundled ESM builds across all plugins. The configuration matches the standard template as per coding guidelines.

plugins/tracer/test/tracer.test.ts (1)

1-1: LGTM! Type-only import improves TypeScript semantics.

Changing to type MockApplication correctly indicates that MockApplication is only used as a type annotation (line 8), not as a runtime value. This follows TypeScript best practices and can improve bundle size.

plugins/tracer/test/error.tracer.test.ts (1)

1-1: LGTM! Type-only import improves TypeScript semantics.

Changing to type MockApplication correctly indicates that MockApplication is only used as a type annotation (line 7), not as a runtime value. This follows TypeScript best practices and is consistent with the identical change in tracer.test.ts.

plugins/security/test/xss.test.ts (1)

6-7: Centralize Windows test skips with tracking issue

Tests in plugins/security/test/*.test.ts are skipped on Windows using // windows unstable and Vitest’s skipIf, which reduces Windows coverage. No existing issue was found—please file a GitHub issue detailing the root cause, then update each skip comment to

// windows unstable – see issue #<XXXX>

or consolidate these skips into a shared helper.

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

5-20: LGTM!

The schema definitions comprehensively demonstrate TypeBox features including required/optional fields, format validations, and transformations. This provides good test coverage for the validation plugin.


23-35: LGTM!

The create method effectively demonstrates both validation approaches: tValidate (throws on failure) and tValidateWithoutThrow (returns boolean). The comparison on line 33 is intentional for testing API consistency.


53-85: LGTM!

The delete and put methods effectively demonstrate different validation behaviors: custom error messages (delete) and redirect on failure (put). While the methods share similar logic, this duplication is acceptable in test fixtures as they test distinct validation patterns.


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

❤️ Share

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

@gemini-code-assist
Copy link
Contributor

Summary of Changes

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

This pull request integrates the egg-typebox-validate plugin into the main Egg.js monorepo. This strategic move aims to streamline development, standardize dependencies, and enhance the overall maintainability of the validation plugin. It ensures that the plugin adheres to the monorepo's structural and technical guidelines, providing a consistent and robust validation solution for TypeScript Egg.js projects.

Highlights

  • Plugin Integration: The egg-typebox-validate plugin has been merged into the monorepo, centralizing its development and maintenance within the Egg.js ecosystem.
  • Package Renaming and Versioning: The package has been renamed to @eggjs/typebox-validate and updated to version 4.0.0-beta.22, aligning with monorepo naming conventions.
  • Dependency Management: Dependencies such as ajv, ajv-formats, ajv-keywords, and @sinclair/typebox have been updated to use catalog versions, promoting consistency and easier updates across the monorepo.
  • Testing Framework Migration: The plugin's tests have been migrated from Mocha to Vitest, ensuring modern and efficient testing practices.
  • Build and Type Configuration: A standard tsdown.config.ts with unplugin-unused has been added for optimized builds, alongside proper TypeScript module augmentation and tsconfig.json updates for better type safety and project integration.
Using Gemini Code Assist

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

Invoking Gemini

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

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

Customization

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

Limitations & Feedback

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

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

Footnotes

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

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 5, 2025

Deploying egg with  Cloudflare Pages  Cloudflare Pages

Latest commit: 614aca0
Status:🚫  Build failed.

View logs

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR 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';
Copy link

Copilot AI Oct 5, 2025

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.

Suggested change
import { Validate } from '../../../../../../src/decorator.js';
import { Validate } from '@src/decorator.js';

Copilot uses AI. Check for mistakes.
@@ -0,0 +1,86 @@
import { Controller } from 'egg';
import { Static, Type } from '../../../../../../src/typebox.ts';
import { ValidateFactory, Validate } from '../../../../../../src/decorator.ts';
Copy link

Copilot AI Oct 5, 2025

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.

Suggested change
import { ValidateFactory, Validate } from '../../../../../../src/decorator.ts';
import { ValidateFactory, Validate } from '@src/decorator';

Copilot uses AI. Check for mistakes.
Comment on lines +47 to +48
// @ts-ignore
errors: this.app.ajv.errors,
Copy link

Copilot AI Oct 5, 2025

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.

Suggested change
// @ts-ignore
errors: this.app.ajv.errors,
errors: (this.app as any).ajv.errors,

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +12
// @ts-expect-error - keyWords types are not fully compatible
keyWords(ajv, 'transform');
// @ts-expect-error - addFormats types are not fully compatible
addFormats(ajv, [
Copy link

Copilot AI Oct 5, 2025

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.

Copilot uses AI. Check for mistakes.
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Oct 5, 2025

Deploying egg-v3 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 614aca0
Status:🚫  Build failed.

View logs

@codecov
Copy link

codecov bot commented Oct 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.13%. Comparing base (ad07aca) to head (614aca0).
⚠️ Report is 2 commits behind head on next.

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.
📢 Have feedback on the report? Share it here.

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

Copy link
Contributor

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

Choose a reason for hiding this comment

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

Code Review

This pull request successfully 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"
Copy link
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
"node": ">= 22.18.0"
"node": ">=22.8.0"

Comment on lines 8 to 15
[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
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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).

Suggested change
[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

这就是这个库想要解决的问题,对于参数校验,写一遍类型就够了:

```diff
+ import { Static, Type } from 'egg-typebox-validate/typebox';
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
+ 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),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
currentSchema: JSON.stringify(schema),
currentSchema: app.config.env !== 'prod' ? JSON.stringify(schema) : undefined,

Comment on lines 2 to 4
import { Static, Type } from '../../../../../../src/typebox.js';
import { Validate } from '../../../../../../src/decorator.js';
import { TYPEBOX_BODY } from '../controller/home.js';
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

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.

Suggested change
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';

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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/tsconfig directly 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ad14e0 and d8eb97d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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.ts
  • plugins/typebox-validate/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • plugins/typebox-validate/src/types.ts
  • plugins/typebox-validate/src/typebox.ts
  • plugins/typebox-validate/src/decorator.ts
  • plugins/typebox-validate/src/config/config.default.ts
  • plugins/typebox-validate/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.ts
  • plugins/typebox-validate/src/app/extend/context.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/test/index.test.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
  • plugins/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.ts
  • plugins/typebox-validate/src/index.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/config.default.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • plugins/typebox-validate/src/types.ts
  • plugins/typebox-validate/src/typebox.ts
  • plugins/typebox-validate/src/decorator.ts
  • plugins/typebox-validate/src/config/config.default.ts
  • plugins/typebox-validate/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.ts
  • plugins/typebox-validate/src/app/extend/context.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/test/index.test.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
  • plugins/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.json
  • plugins/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.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/service/home.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/router.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/app/controller/home.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.json
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/tsconfig.json
  • 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
{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.yaml
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/package.json
  • plugins/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.json
  • plugins/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.json
  • plugins/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.json
  • plugins/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 suites

Test 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.json
  • 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/*/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.ts
  • 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 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.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
  • plugins/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 if unbundle should be enabled.

The coding guideline states "Each package should include tsdown.config.ts for unbundled ESM builds", which suggests unbundle: true should 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';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

Comment on lines 1 to 4
import './config/config.default.ts';
import './app/extend/context.ts';
import './app.ts';
import './types.ts';
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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).

Comment on lines +1 to +5
{
"name": "egg-typebox-validate-test",
"version": "0.0.1",
"type": "module"
}
Copy link
Contributor

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.

Suggested change
{
"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
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 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-formats and ajv-keywords versions 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-tags

Length of output: 384


Update outdated package versions

pnpm-workspace.yaml lines 20, 62–64:

  • bump @sinclair/typebox from ^0.23.0 to ^0.34.41
  • bump ajv from ^8.8.2 to ^8.17.1
  • bump ajv-formats from ^2.1.1 to ^3.0.1
  • ajv-keywords remains 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 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 mandated clean script.

Plugin package.json files must expose a clean script (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 a lint:fix companion, but this block still runs plain oxlint and omits lint: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 tsdown and then immediately rimraf dist *.tsbuildinfo wipes out the artifacts you just produced, so tsc -p tsconfig.build.json ends 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 required lint:fix script.

Repo guidelines mandate both lint and lint: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 required clean script

Per our plugin guidelines, every plugin package.json must expose a clean script (typically rimraf dist). Please add it back so this package stays in compliance.

plugins/session/package.json (1)

67-73: Add the required clean script per plugin standards

Per our plugin package guidelines, every plugin must expose a clean script (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: Add dts: true for consistency with other packages.

All other packages in this PR (packages/core, packages/cookies, packages/supertest, packages/cluster, and plugins) explicitly set dts: true in their tsdown configurations. While tsdown may auto-enable dts generation when package.json has a types field, explicit configuration improves consistency and clarity across the monorepo.

Apply this diff to add the missing dts option:

 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-validate for the eggjs/egg URLs 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-validate scope.

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 /typebox and /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: true aligns 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 tValidate method 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

📥 Commits

Reviewing files that changed from the base of the PR and between d8eb97d and 2aa30c2.

📒 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.json
  • packages/cluster/tsconfig.json
  • plugins/logrotator/tsconfig.json
  • packages/koa/tsconfig.json
  • plugins/session/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • plugins/multipart/tsconfig.json
  • plugins/tracer/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/i18n/tsconfig.json
  • packages/core/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/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.json
  • packages/koa/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/cookies/tsconfig.json
  • packages/core/tsconfig.json
  • packages/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.json
  • packages/koa/tsconfig.json
  • packages/koa-static-cache/tsconfig.json
  • packages/cookies/tsconfig.json
  • packages/core/tsconfig.json
  • packages/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.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/koa-static-cache/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • packages/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.ts
  • packages/core/src/egg.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/koa-static-cache/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • plugins/typebox-validate/src/app/extend/context.ts
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • plugins/typebox-validate/src/decorator.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
  • packages/cookies/tsdown.config.ts
  • 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:

  • packages/core/tsdown.config.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/koa-static-cache/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • packages/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.ts
  • packages/core/src/egg.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/koa-static-cache/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • plugins/typebox-validate/src/app/extend/context.ts
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • plugins/typebox-validate/src/decorator.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • plugins/typebox-validate/test/fixtures/apps/typebox-validate-test/config/plugin.ts
  • packages/cookies/tsdown.config.ts
  • plugins/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.json
  • plugins/watcher/package.json
  • packages/egg/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • packages/koa/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • packages/router/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/session/package.json
  • plugins/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.json
  • plugins/watcher/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/session/package.json
  • plugins/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.json
  • plugins/watcher/package.json
  • packages/egg/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • packages/koa/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • packages/router/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/session/package.json
  • plugins/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.json
  • plugins/watcher/package.json
  • packages/egg/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • packages/koa/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • packages/router/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/session/package.json
  • plugins/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.json
  • packages/koa/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • packages/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.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/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.json
  • packages/cluster/tsconfig.json
  • plugins/logrotator/tsconfig.build.json
  • plugins/logrotator/tsconfig.json
  • packages/core/tsconfig.build.json
  • plugins/security/tsconfig.build.json
  • packages/supertest/tsconfig.build.json
  • packages/koa/tsconfig.json
  • packages/utils/tsconfig.build.json
  • plugins/session/tsconfig.json
  • plugins/typebox-validate/tsconfig.build.json
  • plugins/watcher/tsconfig.build.json
  • plugins/development/tsconfig.build.json
  • packages/koa-static-cache/tsconfig.json
  • plugins/multipart/tsconfig.json
  • plugins/static/tsconfig.build.json
  • plugins/view/tsconfig.build.json
  • packages/cookies/tsconfig.build.json
  • packages/extend2/tsconfig.build.json
  • plugins/tracer/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/i18n/tsconfig.json
  • packages/core/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/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.json
  • packages/core/tsdown.config.ts
  • plugins/logrotator/tsconfig.build.json
  • packages/router/tsdown.config.ts
  • plugins/security/tsconfig.build.json
  • packages/supertest/tsconfig.build.json
  • packages/supertest/tsdown.config.ts
  • packages/koa-static-cache/tsdown.config.ts
  • packages/utils/tsconfig.build.json
  • plugins/typebox-validate/tsconfig.build.json
  • plugins/watcher/tsconfig.build.json
  • packages/extend2/tsdown.config.ts
  • plugins/development/tsconfig.build.json
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/multipart/tsconfig.json
  • plugins/jsonp/tsdown.config.ts
  • plugins/static/tsconfig.build.json
  • plugins/onerror/tsdown.config.ts
  • plugins/view/tsconfig.build.json
  • packages/cookies/tsconfig.build.json
  • packages/extend2/tsconfig.build.json
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • packages/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.json
  • packages/cluster/tsconfig.json
  • plugins/logrotator/tsconfig.build.json
  • plugins/logrotator/tsconfig.json
  • packages/core/tsconfig.build.json
  • plugins/security/tsconfig.build.json
  • packages/supertest/tsconfig.build.json
  • packages/koa/tsconfig.json
  • packages/utils/tsconfig.build.json
  • plugins/session/tsconfig.json
  • plugins/typebox-validate/tsconfig.build.json
  • plugins/watcher/tsconfig.build.json
  • plugins/development/tsconfig.build.json
  • packages/koa-static-cache/tsconfig.json
  • plugins/multipart/tsconfig.json
  • plugins/static/tsconfig.build.json
  • plugins/view/tsconfig.build.json
  • packages/cookies/tsconfig.build.json
  • packages/extend2/tsconfig.build.json
  • plugins/tracer/tsconfig.json
  • packages/cookies/tsconfig.json
  • plugins/i18n/tsconfig.json
  • packages/core/tsconfig.json
  • packages/router/tsconfig.json
  • plugins/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.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • packages/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.ts
  • packages/router/tsdown.config.ts
  • packages/supertest/tsdown.config.ts
  • packages/extend2/tsdown.config.ts
  • plugins/mock/tsdown.config.ts
  • plugins/multipart/tsdown.config.ts
  • plugins/schedule/tsdown.config.ts
  • plugins/jsonp/tsdown.config.ts
  • plugins/onerror/tsdown.config.ts
  • packages/cluster/tsdown.config.ts
  • packages/koa/tsdown.config.ts
  • packages/utils/tsdown.config.ts
  • plugins/tracer/tsdown.config.ts
  • plugins/i18n/tsdown.config.ts
  • plugins/logrotator/tsdown.config.ts
  • plugins/session/tsdown.config.ts
  • plugins/development/tsdown.config.ts
  • plugins/static/tsdown.config.ts
  • packages/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.json
  • plugins/watcher/package.json
  • packages/egg/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • packages/koa/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • packages/router/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/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.json
  • packages/egg/package.json
  • plugins/tracer/package.json
  • plugins/view/package.json
  • packages/core/package.json
  • packages/extend2/package.json
  • plugins/i18n/package.json
  • plugins/mock/package.json
  • plugins/onerror/package.json
  • packages/utils/package.json
  • packages/koa-static-cache/package.json
  • packages/supertest/package.json
  • plugins/multipart/package.json
  • plugins/logrotator/package.json
  • plugins/security/package.json
  • plugins/development/package.json
  • plugins/schedule/package.json
  • plugins/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.json
  • packages/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.json
  • plugins/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.ts
  • plugins/typebox-validate/src/types.ts
  • plugins/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.

extends and compilerOptions.baseUrl follow the required pattern for plugin tsconfigs. No further changes needed.

packages/router/tsconfig.json (1)

4-5: Configuration aligns with monorepo guidelines.

baseUrl is 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.

baseUrl is correctly set alongside the shared extends path, so this sub-project stays compliant. Based on learnings

packages/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.json and scoping rootDir/outDir here 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: true properly 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: true is 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: true is 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: true is 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: true aligns 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: true aligns 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: true aligns 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: true aligns 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: true aligns 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.json follows the repository pattern for build-specific TypeScript configurations, appropriately extending the local tsconfig.json and defining build-specific compiler options and exclusions.

packages/cookies/tsdown.config.ts (1)

7-7: LGTM! Unbundling enabled consistently.

The addition of unbundle: true aligns 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: true aligns 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 baseUrl setting. The separation of build-specific options into tsconfig.build.json is 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.json and properly cleans up TypeScript build artifacts including *.tsbuildinfo files. This aligns with the repository-wide standardization effort.

packages/router/tsdown.config.ts (1)

5-5: LGTM! Unbundled build mode enabled.

Enabling unbundle: true aligns 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.json and cleaning *.tsbuildinfo files. The mustache template copy step is correctly preserved.

Note: The plugin is missing some scripts recommended by coding guidelines (clean, lint:fix as separate scripts, and test should run lint: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 *.tsbuildinfo cleanup and switching to the dedicated tsconfig.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 ctx type from Koa's generic KoaContext to Egg's extended Context type, which is a standard pattern when extending Koa's type system. The circular reference between Request.ctx and Context.request is 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 EggPlugin type, and enables the @eggjs/typebox-validate plugin. 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 Context interface 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 .ts extensions, following the coding guideline that all plugins must define src/types.ts with .ts extensions 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 ValidateRule tuple 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 ValidateFactory implementation correctly:

  • Preserves the this context using fn.apply(this, args) (line 26)
  • Uses ctx.tValidateWithoutThrow to 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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.

Comment on lines +58 to +65
"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"
},
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

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.

Suggested change
"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.

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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.

Comment on lines +32 to 33
"build": "tsdown && rimraf dist *.tsbuildinfo && tsc -p tsconfig.build.json",
"prepublishOnly": "pnpm run build"
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
"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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ 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.errors immediately 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

📥 Commits

Reviewing files that changed from the base of the PR and between 2aa30c2 and e93a37f.

📒 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)

@fengmk2 fengmk2 merged commit c26e0e9 into next Oct 5, 2025
31 of 34 checks passed
@fengmk2 fengmk2 deleted the egg-typebox-validate branch October 5, 2025 06:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant