Skip to content

chore: add code-inspector-plugin integration - #2476

Merged
seefs001 merged 1 commit into
QuantumNous:mainfrom
TinsFox:chore/code-inspector-plugin
Dec 20, 2025
Merged

chore: add code-inspector-plugin integration#2476
seefs001 merged 1 commit into
QuantumNous:mainfrom
TinsFox:chore/code-inspector-plugin

Conversation

@TinsFox

@TinsFox TinsFox commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Add the code-inspector-plugin to quickly locate the source code position in development mode.

https://github.com/zh-lx/code-inspector

image

Summary by CodeRabbit

  • Chores
    • Integrated code inspection capability into the build configuration.
    • Added internationalization library dependencies.

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

@coderabbitai

coderabbitai Bot commented Dec 19, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The changes integrate the code-inspector-plugin into the project by adding it as a dependency and configuring it in the Vite build tool. Additionally, i18next-cli is relocated from devDependencies to dependencies, and vite is removed from devDependencies.

Changes

Cohort / File(s) Summary
Dependency Management
web/package.json
Added code-inspector-plugin as a dependency; moved i18next-cli from devDependencies to dependencies; removed vite from devDependencies
Build Configuration
web/vite.config.js
Imported codeInspectorPlugin and added it to the Vite plugins array with bundler configuration

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

  • Simple dependency additions and reorganization in package.json
  • Straightforward plugin integration in vite.config.js with no complex logic
  • Both changes follow standard patterns with minimal risk of side effects

Poem

🐰 A plugin hops into our build,
The inspector's code-detecting skill,
Dependencies dance to their new place,
Config files glow with a plugin's grace!

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 accurately and concisely describes the primary change: adding code-inspector-plugin integration to the project.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a98aad2 and e6ec551.

⛔ Files ignored due to path filters (1)
  • web/bun.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • web/package.json (1 hunks)
  • web/vite.config.js (2 hunks)
🔇 Additional comments (1)
web/vite.config.js (1)

24-24: LGTM - Import statement is correct.

The import statement for codeInspectorPlugin is syntactically correct and follows ES module conventions.

Comment thread web/package.json
"@so1ve/prettier-config": "^3.1.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.21",
"code-inspector-plugin": "^1.3.3",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Correct the version specifier to match the latest available release.

The latest released version of code-inspector-plugin is 1.3.0, but the package.json specifies ^1.3.3. Using the caret operator, the version ^1.3.3 expects version 1.3.3 or higher, which does not exist on npm and will cause installation to fail. Change the version to ^1.3.0.

🤖 Prompt for AI Agents
In web/package.json around line 81, the dependency "code-inspector-plugin" is
incorrectly pinned to "^1.3.3" which does not exist; update the version
specifier to "^1.3.0" in that line to match the latest released package, then
run npm install (or yarn install) to update node_modules and regenerate the
lockfile (package-lock.json or yarn.lock).

Comment thread web/package.json
"eslint": "8.57.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-react-hooks": "^5.2.0",
"i18next-cli": "^1.10.3",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify if this change is related to the PR objective.

The addition of i18next-cli to devDependencies appears unrelated to the PR's stated objective of integrating code-inspector-plugin. The AI summary mentions this as a "relocation" but doesn't explain why it's included in this PR.

If this is an intentional refactoring, consider mentioning it in the PR description for clarity.

🤖 Prompt for AI Agents
In web/package.json around line 85, the added devDependency "i18next-cli":
"^1.10.3" looks unrelated to the PR goal (integrating code-inspector-plugin);
either remove this dependency from the current commit or explicitly document why
it was added. If intended, update the PR description to state the rationale
(e.g., required tooling for localisation, relocation of i18n scripts, or
preparatory refactor) and justify why it belongs in this PR; otherwise revert
the change and submit it in a separate commit/PR.

Comment thread web/package.json
"typescript": "4.4.2",
"vite": "^5.2.0",
"i18next-cli": "^1.10.3"
"vite": "^5.2.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clarify if this change is related to the PR objective.

The addition of vite to devDependencies appears unrelated to the PR's stated objective of integrating code-inspector-plugin. The AI summary mentions vite was "removed from devDependencies" elsewhere, but this seems inconsistent.

If this is an intentional dependency restructuring, consider documenting it in the PR description.

🤖 Prompt for AI Agents
In web/package.json at line 90, the addition of "vite": "^5.2.0" looks unrelated
to the PR objective (code-inspector-plugin) and conflicts with other notes that
vite was removed; update the PR so reviewers understand intent: either remove
the vite entry if it was added accidentally, or keep it and add a short note in
the PR description explaining why vite was added/reshuffled (e.g., required for
plugin dev, build changes, or devDependency consolidation) and ensure
package.json changes are consistent across the repo (remove duplicates or
reflect removal elsewhere).

Comment thread web/vite.config.js
Comment on lines +35 to +37
codeInspectorPlugin({
bundler: 'vite',
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

cd web && cat vite.config.js

Repository: QuantumNous/new-api

Length of output: 2838


Explicitly restrict codeInspectorPlugin to development builds.

The plugin is currently included unconditionally in the Vite configuration, which means it will be bundled in production. Add an environment check:

  plugins: [
+    ...(process.env.NODE_ENV === 'development' ? [
      codeInspectorPlugin({
        bundler: 'vite',
      }),
+    ] : []),

This ensures the development-only tool does not execute or bloat production builds.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In web/vite.config.js around lines 35-37, the codeInspectorPlugin is added
unconditionally which causes it to be bundled into production; restrict it to
development by checking the environment (e.g., const isDev =
process.env.NODE_ENV === 'development' || config.mode === 'development') and
only include the plugin when isDev is true (e.g., conditionally push or spread
the plugin into the plugins array). To avoid pulling the plugin into production
even at import time, require or import() the plugin lazily inside the isDev
branch instead of importing it at module top-level.

@seefs001
seefs001 merged commit a343ce8 into QuantumNous:main Dec 20, 2025
1 check passed
ennnnny pushed a commit to ennnnny/new-api that referenced this pull request Mar 17, 2026
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.

2 participants