-
Notifications
You must be signed in to change notification settings - Fork 0
code format & warning log #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Adds a version check mechanism across all modules to ensure compatibility and adds a build script to inject version checks during build process. Removes old breaking changes warning and implements global debug log prevention. 更新:在所有模块中添加版本检查机制以确保兼容性, 并在构建过程中添加注入版本检查的构建脚本。 移除旧的破坏性更改警告并实现全局调试日志预防。 BREAKING CHANGE: removes old breaking changes warning in favor of new version check mechanism 重大变更:移除旧的破坏性更改警告,改为新的版本检查机制 Change-Id: Ia2dba4bca48c2e0bedd19c60c5467a790f11ad4a Signed-off-by: OhYee <[email protected]>
adds prettier configuration and integrates it into the linting workflow to enforce consistent code style across the project. also updates eslint configuration to include prettier rules and adds format commands to package.json. adds prettier 配置并将其集成到 linting 工作流程中,以在整个项目中强制执行一致的代码样式。还更新了 eslint 配置以包含 prettier 规则,并在 package.json 中添加了格式化命令。 Change-Id: I077c5695ff26d06b27fd983fbfaa212370180329 Signed-off-by: OhYee <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request implements code formatting standardization using Prettier and refactors the SDK's version warning system. The PR transforms the codebase to follow consistent formatting rules and moves the breaking changes warning from src/index.ts to a new centralized version check module that is automatically imported across all entry points.
Changes:
- Added Prettier configuration and integrated it with ESLint for automated code formatting
- Refactored version warning system into a new
src/utils/version-check.tsmodule with deduplication logic - Applied consistent code formatting across all TypeScript files (quote style, arrow functions, line breaks, trailing commas)
Reviewed changes
Copilot reviewed 144 out of 150 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
.prettierrc, .prettierignore |
New Prettier configuration with rules for consistent code formatting |
.eslintrc.json |
Updated to integrate Prettier with ESLint for unified linting/formatting |
package.json |
Added Prettier dependency, updated build and format scripts |
src/utils/version-check.ts |
New module centralizing version warning with global deduplication |
src/utils/log.ts |
Added deduplication for debug logging warning |
src/index.ts |
Removed inline version warning code (moved to version-check module) |
scripts/inject-version-check.mjs |
New script to auto-inject version check imports into all index.ts files |
All */index.ts files |
Added import '@/utils/version-check' statement |
| Test files | Applied consistent formatting (quotes, spacing, arrow functions, trailing commas) |
| Example files | Applied consistent formatting |
| Documentation | Updated formatting in README and templates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ) { | ||
| (globalThis as any)._AGENTRUN_VERSION_WARNING_SHOWN = true; | ||
| logger.warn( | ||
| `当前您正在使用 AgentRun Node.js SDK 版本 ${VERSION}。早期版本通常包含许多新功能,这些功能 可能引入不兼容的变更 。为避免潜在问题,我们强烈建议 将依赖锁定为此版本 。\nYou are currently using AgentRun Node.js SDK version ${VERSION}. Early versions often include many new features, which may introduce breaking changes. To avoid potential issues, we strongly recommend pinning the dependency to this version.\n npm install "@agentrun/sdk@${VERSION}"\n bun add "@agentrun/sdk@${VERSION}"\n\n增加 DISABLE_BREAKING_CHANGES_WARNING=1 到您的环境变量以关闭此警告。\nAdd DISABLE_BREAKING_CHANGES_WARNING=1 to your environment variables to disable this warning.\n\nReleases: https://github.com/Serverless-Devs/agentrun-sdk-nodejs/releases` |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The warning message on line 12 contains extra spaces in the Chinese text that appear to be formatting errors. The phrase "这些功能 可能引入不兼容的变更 。" has spaces before "可能引入不兼容的变更" and before the period, and "我们强烈建议 将依赖锁定为此版本 。" has spaces before "将依赖锁定为此版本" and before the period. These should be removed for proper Chinese grammar.
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = dirname(__filename); | ||
| const projectRoot = resolve(__dirname, '..'); |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable projectRoot.
| const projectRoot = resolve(__dirname, '..'); |
| BackendType, | ||
| ModelType, | ||
| } from '../../../src/model'; | ||
| import { ModelClient, ModelService, ModelProxy, BackendType, ModelType } from '../../../src/model'; |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused imports BackendType, ModelClient.
| ResourceNotExistError, | ||
| ResourceAlreadyExistError, | ||
| } from '../../../src/utils/exception'; | ||
| import { ResourceNotExistError, ResourceAlreadyExistError } from '../../../src/utils/exception'; |
Copilot
AI
Jan 30, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused import ResourceAlreadyExistError.
Change npm test command to make coverage for improved test reporting 将 npm 测试命令更改为 make coverage,以改进测试报告 Change-Id: I25cf5b0c4b48bc4a2811fde07f7417e03577b001 Signed-off-by: OhYee <[email protected]>
Fix bugs
Bug detail
Pull request tasks
Update docs
Reason for update
Pull request tasks
Add contributor
Contributed content
Content detail
Others
Reason for update