[fit-launcher] 使用 Node.js 重写启动脚本,实现真正的跨平台支持#366
Merged
CodeCasterX merged 4 commits into3.5.xfrom Nov 9, 2025
Merged
Conversation
主要改进: 1. 启动脚本重构 - 使用 Node.js 重写核心启动逻辑 (fit.js) - Unix/Linux/macOS 使用 fit 脚本(Node.js 实现) - Windows 使用 fit.cmd 批处理文件 - 移除旧的 fit.bat 文件 2. 跨平台兼容性 - 解决 Bash 脚本在不同系统上的兼容性问题 - 避免 macOS 上 readlink -f 不可用的问题 - 统一 Windows/Linux/macOS 的使用体验 3. 功能增强 - 改进错误处理和错误信息输出 - 正确处理进程信号 (SIGINT/SIGTERM) - 更清晰的参数解析逻辑 - 更好的代码可维护性 4. 文档更新 - 重构模块 README,从模块级别进行说明 - 添加架构设计、启动流程等技术文档 - 完善使用说明和故障排除指南 技术栈:Node.js 12+ 命令接口保持完全兼容,无需修改现有文档和脚本
添加项目级别的开发规范和自动化规则: 1. 文件权限管理规则 - 动态获取文件所有者信息,避免硬编码用户名 - 从 pom.xml 等参考文件自动获取权限设置 - 支持跨协作者使用,提高团队协作便利性 2. Pull Request 提交规范 - 自动读取 .github/PULL_REQUEST_TEMPLATE.md - 确保 PR 描述符合项目规范 - 简化 PR 创建流程 配置文件位置:.claude/project-rules.md 适用范围:所有使用 Claude Code 的项目协作者
新增功能: 1. 脚手架命令 (fit init) - 支持快速创建 FIT 项目结构 - 交互式输入项目信息 - 命令行参数模式支持 - 自动生成标准项目结构 2. 项目模板生成 - pom.xml(包含 FIT 依赖配置) - Application.java(启动类) - HelloController.java(示例控制器) - Message.java(示例领域模型) - README.md(项目文档) - .gitignore(版本控制忽略文件) 3. 命令参数 - --group-id: 指定 Maven Group ID - --artifact-id: 指定 Maven Artifact ID - --package: 指定 Java 包名 - 支持交互式和非交互式两种模式 4. 文档更新 - README 中添加 init 命令使用说明 - 包含详细的使用示例和参数说明 使用示例: ./fit init my-app ./fit init my-app --group-id=com.mycompany --artifact-id=my-app 脚手架功能降低了 FIT 项目的上手难度,提高开发效率
- 支持创建独立的 Service (SPI) 和 Plugin 项目,符合 FIT 框架的插件架构规范 - 将模板代码从 fit.js 中分离到独立的 .tpl 文件,提高可维护性 - 新增交互式引导模式,所有参数均有合理默认值,用户可直接回车使用 - 保持向后兼容,支持命令行参数方式用于自动化场景 - Service 项目使用 build-service goal,Plugin 项目使用 build-plugin 和 package-plugin goals - Plugin 项目自动依赖对应的 Service 项目 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
🎉 新增功能:FIT 脚手架工具本 PR 在 Node.js 启动脚本的基础上,新增了强大的脚手架功能,用于快速初始化 FIT 项目。 主要特性1️⃣ 支持 Service/Plugin 分离架构符合 FIT 框架的插件架构规范,支持创建两种类型的项目:
参考实现: 2️⃣ 交互式引导模式用户体验优化,支持三种使用方式: 完全交互式(最简单) fit init指定项目名的交互式 fit init my-project非交互式(适合 CI/CD) fit init weather-service --type=service --service=Weather
fit init default-weather --type=plugin --service=Weather \
--service-group-id=com.example --service-artifact-id=weather-service3️⃣ 模板系统重构
4️⃣ 智能默认值所有参数都有合理的默认值,用户可直接回车使用:
技术细节Service 项目生成内容:
Plugin 项目生成内容:
使用文档详细使用说明请查看: fit help代码变更
测试状态: ✅ 已通过功能测试 🤖 Generated with Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 相关问题 / Related Issue
📋 变更类型 / Type of Change
📝 变更目的 / Purpose of the Change
中文说明:
原有的 Bash 启动脚本存在跨平台兼容性问题:
readlink -f命令不可用)本次改进使用 Node.js 重写启动脚本,实现真正的跨平台支持,同时保持命令行接口完全兼容,无需修改现有文档和使用方式。
English Description:
The original Bash startup script has cross-platform compatibility issues:
readlink -fcommand not available)This improvement rewrites the startup script using Node.js to achieve true cross-platform support, while maintaining full command-line interface compatibility without modifying existing documentation and usage.
📋 主要变更 / Brief Changelog
启动脚本重构 / Startup Script Refactoring:
fit.js,164 行)fit脚本(Node.js 包装器)fit.cmd批处理文件fit.bat文件跨平台兼容性 / Cross-Platform Compatibility:
readlink -f不可用的问题__dirname实现跨平台路径处理功能增强 / Feature Enhancements:
文档更新 / Documentation Updates:
fit-launcher/README.md,从模块级别进行说明🧪 验证变更 / Verifying this Change
测试步骤 / Test Steps
版本信息测试:
./fit version # 预期输出:Version: 3.5.5-SNAPSHOT帮助信息测试:
启动测试(需要编译后的 JAR 文件):
mvn clean install ./fit start # 预期:能够正常启动应用参数传递测试:
./fit start -Xmx1g -Xms512m testarg # 预期:Java 参数和程序参数都能正确传递Windows 兼容性测试:
测试覆盖 / Test Coverage
fit version,fit help)📸 截图 / Screenshots
测试结果:
文件结构:
✅ 贡献者检查清单 / Contributor Checklist
基本要求 / Basic Requirements:
代码质量 / Code Quality:
测试要求 / Testing Requirements:
mvn -B clean package -Dmaven.test.skip=true/ Basic checks passmvn clean install/ Unit tests pass文档和兼容性 / Documentation and Compatibility:
fit-launcher/README.md./fit start,./fit debug,./fit version,./fit help📋 附加信息 / Additional Notes
技术栈要求 / Technical Stack Requirements:
兼容性保证 / Compatibility Guarantees:
迁移说明 / Migration Notes:
后续计划 / Future Plans:
审查者注意事项 / Reviewer Notes:
重点审查项 / Key Review Points:
跨平台兼容性验证:
向后兼容性检查:
文档完整性:
代码质量:
测试建议 / Testing Suggestions:
潜在风险 / Potential Risks:
收益 / Benefits: