Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(ci): handle numeric literals and surrogate pairs in comment stripper

Steven Enamakelc8647068d74e
diff --git a/scripts/ci/check-crate-chain.mjs b/scripts/ci/check-crate-chain.mjs
index cc394e0e17..fa29574bd9 100644
--- a/scripts/ci/check-crate-chain.mjs
+++ b/scripts/ci/check-crate-chain.mjs
@@ -145,6 +145,8 @@ export function stripRustComments(text, { preserveLiterals = false, compact = fa
((word(left) && word(right)) ||
(word(left) && ['"', "'", '#'].includes(right)) ||
(['"', "'", '#'].includes(left) && word(right)) ||
+ (left === '.' && /[0-9]/.test(right)) ||
+ (/[0-9]/.test(left) && right === '.') ||
joins.has(left + right))) out += ' ';
out += chunk;
pendingBoundary = false;
@@ -194,9 +196,10 @@ export function stripRustComments(text, { preserveLiterals = false, compact = fa
append(preserveLiterals ? text.slice(i, j + 1) : blank(text.slice(i, j + 1)));
i = j + 1;
} else {
- if (compact && /\s/.test(text[i])) pendingBoundary = true;
- else append(text[i]);
- i++;
+ const char = String.fromCodePoint(text.codePointAt(i));
+ if (compact && /\s/.test(char)) pendingBoundary = true;
+ else append(char);
+ i += char.length;
}
}
return out;