scripts: path comparisons break on Windows (check-greys fails the pre-push hook, upgrade-opentui skips nothing)

未关闭 适合新手
#66,192 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@deosiree 已经在做这个了。

开始于 2026年11月24日。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
76/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript

调研方向

从 script/check-greys.ts 中大约第 74 行的 EXCEPTIONS.find 调用开始,并查看 script/upgrade-opentui.ts 中大约第 41-43 行的 file.split("/") 过滤器。两者都将 Bun.Glob 返回的路径(使用平台分隔符)与用 / 书写的字符串进行比较。修复方法是在匹配前统一分隔符,正如 script/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts:31 已经做的那样。完成的标准是:在 Windows 上,bun script/check-greys.ts 以退出码 0 结束,并且豁免项与 Linux 相同;升级脚本在该平台上也会跳过 node_modules 和 dist。

由索引模型根据 Issue 内容生成。

描述

platform/windows status/repro-plausible type/bug version/v2
Description

Two repository scripts compare paths from Bun.Glob against strings written with /. The glob returns the platform separator, so on Windows neither comparison works. The repo already normalises for this in one place (script/oxlint/anti-slop/effect/rules/no-service-constructor-imports.ts:31), so the convention exists and these two missed it.

script/check-greys.ts — fails the pre-push hook on Windows

EXCEPTIONS are written with / (/style\/token\/color\.css$/, /component\/video-editor\//, …) and matched with EXCEPTIONS.find(([re]) => re.test(file)) (:74). On Windows every scanned path is services\site\src\…, so no exception matches and the checker reports greys from the files the list exists to excuse — legacy tokens, the video editor, the font film, print.

Because bun run check is the pre-push hook, every Windows contributor is blocked until they push with --no-verify, which weakens the hook for everyone.

$ bun script/check-greys.ts
services\site\src\style\token\color.css:7  #f5f5f7  not on the scale
…
172 greys off the shared scale (script/check-greys.ts).   # exit 1
script/upgrade-opentui.ts — the skip list silently does nothing
const skip = new Set([".git", ".opencode", ".turbo", "dist", "node_modules"])
…
(file) => !file.split("/").some((part) => skip.has(part))

On Windows file.split("/") yields one part (node_modules\foo\package.json), so skip never matches and the script would rewrite the version field of every package.json under node_modules and dist.

Environment
  • opencode dev at b0cda20
  • Windows 10 22H2, Bun 1.4.5, PowerShell 5.1
Steps to reproduce
  1. Clone on Windows without Developer Mode.
  2. bun script/check-greys.ts → 172 problems, exit 1. On Linux the same command exits 0.
  3. Read script/upgrade-opentui.ts:41-43: the filter keeps node_modules and dist entries on Windows.
Expected behavior

Both scripts match on a separator-normalised path, so the same files are exempted and the same directories are skipped on every platform.

Additional context

Fixes are ready on two branches (check-greys one expression; upgrade-opentui one expression). Verified on Windows: bun script/check-greys.ts exit 1 → 0, bun run lint exit 0, and bun run check 36/36 tasks exit 0 once the checkout's 29 symlinks are materialised (they land as text files without Developer Mode, which is a separate, environment-only obstacle).

主要语言
TypeScript
星标
228k
派生
31k
平均合并
5 小时 19 分钟
30 天内合并 PR
457

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode 的其他 Issue

查看 anomalyco/opencode 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。