fix: correct validator messages and init command reference#24
Merged
Conversation
leaperone-bot
approved these changes
Mar 31, 2026
leaperone-bot
left a comment
There was a problem hiding this comment.
🤖 Code Review 🟢
审查摘要
这个 PR 修复了两个已知问题(#11 和 #12),改动范围小且明确,逻辑正确。
✅ config-validator.ts 修复
类型定义验证一致性:EnvxConfig.files 的类型定义为 string | string[] | undefined,但原有验证逻辑仅检查 typeof config.files !== 'string',这意味着合法的数组类型会被误报为错误。PR 新增了数组类型和数组元素类型的校验,与类型定义完全一致。
- 注释从错误的
clone 字段验证改为正确的files 字段验证✅ - 错误信息从
clone 字段改为files 字段✅ - 新增
Array.isArray分支并使用.every()验证数组元素类型 ✅
注意:
validatePaths方法中仍有多处注释使用了clone一词(如全局 clone 路径、环境变量的 clone 路径),建议后续统一清理,但这不属于本 PR 范围。
✅ init.ts 修复
将不存在的 envx clone 命令引用替换为 envx load --all。已确认 src/commands/load.ts 存在,命令引用正确。
📝 建议(非阻塞)
- 测试覆盖:目前
config-validator.ts没有对应的单元测试文件。新增的数组验证逻辑(空数组、混合类型数组等边界情况)建议在后续补充测试。 - 残留的
clone注释:validatePaths方法中仍有clone相关注释,可考虑在后续 PR 中统一清理。
整体改动准确、范围可控,可以合并。
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.
Closes #11, closes #12
Summary
clonereferences tofiles, support array type validationenvx clonewithenvx load --all