Skip to content

fix: correct validator messages and init command reference#24

Merged
cunoe merged 1 commit intomainfrom
fix/issue-11-12-validator-and-init
Mar 31, 2026
Merged

fix: correct validator messages and init command reference#24
cunoe merged 1 commit intomainfrom
fix/issue-11-12-validator-and-init

Conversation

@cunoe
Copy link
Copy Markdown
Contributor

@cunoe cunoe commented Mar 31, 2026

Closes #11, closes #12

Summary

  • Fix config-validator: rename clone references to files, support array type validation
  • Fix init command: replace non-existent envx clone with envx load --all

Copy link
Copy Markdown

@leaperone-bot leaperone-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 🟢

审查摘要

这个 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 存在,命令引用正确。

📝 建议(非阻塞)

  1. 测试覆盖:目前 config-validator.ts 没有对应的单元测试文件。新增的数组验证逻辑(空数组、混合类型数组等边界情况)建议在后续补充测试。
  2. 残留的 clone 注释validatePaths 方法中仍有 clone 相关注释,可考虑在后续 PR 中统一清理。

整体改动准确、范围可控,可以合并。

@cunoe cunoe merged commit bcefda2 into main Mar 31, 2026
1 of 2 checks passed
@cunoe cunoe deleted the fix/issue-11-12-validator-and-init branch March 31, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

init 命令引导用户执行不存在的 clone 命令 config-validator 注释/错误信息与代码不一致

2 participants