Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(build): comment gate could not see a new file

yhh11c58e149d58
diff --git a/desktop/electron/pathSandbox.ts b/desktop/electron/pathSandbox.ts
index 201ec4c71..124051313 100644
--- a/desktop/electron/pathSandbox.ts
+++ b/desktop/electron/pathSandbox.ts
@@ -56,12 +56,10 @@ export function realPathOf(abs: string): string {
}
/**
- * Whether `abs` is really inside `root`. Lexical containment is not containment:
- * a link inside the root holds no `..` and points wherever it likes, so both
- * sides are compared with links resolved as well.
- *
- * Racing a link swapped between this and the call that follows needs O_NOFOLLOW,
- * which node does not expose portably — this raises the bar, it is not a seal.
+ * Whether `abs` is really inside `root`. A link inside the root holds no `..`, so
+ * both sides are compared with links resolved as well. Racing a link swapped
+ * after this check needs O_NOFOLLOW, which node lacks — this raises the bar
+ * rather than sealing it.
*/
export function isInsideRoot(root: string, abs: string): boolean {
const resolved = path.resolve(abs);
diff --git a/tools/check-comment-style.mjs b/tools/check-comment-style.mjs
index e284cf5f9..643b176ef 100644
--- a/tools/check-comment-style.mjs
+++ b/tools/check-comment-style.mjs
@@ -62,6 +62,16 @@ function addedLines() {
const diff = execFileSync('git', args, { cwd: ROOT, encoding: 'utf8', maxBuffer: 256 * 1024 * 1024 });
const byFile = new Map();
+ // A file git has never seen produces no diff, and a brand-new file is exactly
+ // where prose collects — every line of it is added.
+ const untracked = execFileSync('git', ['ls-files', '--others', '--exclude-standard'],
+ { cwd: ROOT, encoding: 'utf8', maxBuffer: 64 * 1024 * 1024 });
+ for (const f of untracked.split('\n')) {
+ if (!f || SKIP.test(f) || !SOURCE.test(f)) continue;
+ try {
+ byFile.set(f, readFileSync(path.join(ROOT, f), 'utf8').split('\n').map((t, i) => [i + 1, t]));
+ } catch { /* vanished between listing and reading */ }
+ }
let file = null;
let line = 0;
for (const raw of diff.split('\n')) {