@chrisdudek/yg 5.0.1 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -5379,9 +5379,25 @@ async function walkRepoFiles(projectRoot) {
5379
5379
  // src/io/hash.ts
5380
5380
  var require3 = createRequire2(import.meta.url);
5381
5381
  var ignoreFactory2 = require3("ignore");
5382
+ var CR = 13;
5383
+ var LF = 10;
5384
+ function normalizeLineEndings(bytes) {
5385
+ if (!bytes.includes(CR)) return bytes;
5386
+ const out = Buffer.allocUnsafe(bytes.length);
5387
+ let w = 0;
5388
+ for (let i = 0; i < bytes.length; i++) {
5389
+ if (bytes[i] === CR) {
5390
+ out[w++] = LF;
5391
+ if (bytes[i + 1] === LF) i++;
5392
+ } else {
5393
+ out[w++] = bytes[i];
5394
+ }
5395
+ }
5396
+ return out.subarray(0, w);
5397
+ }
5382
5398
  async function hashFile(filePath) {
5383
5399
  const content14 = await readFile14(filePath);
5384
- return createHash("sha256").update(content14).digest("hex");
5400
+ return hashBytes(content14);
5385
5401
  }
5386
5402
  async function loadRootGitignoreStack2(projectRoot) {
5387
5403
  if (!projectRoot) return [];
@@ -5406,7 +5422,7 @@ function hashString(content14) {
5406
5422
  return createHash("sha256").update(content14).digest("hex");
5407
5423
  }
5408
5424
  function hashBytes(bytes) {
5409
- return createHash("sha256").update(bytes).digest("hex");
5425
+ return createHash("sha256").update(normalizeLineEndings(bytes)).digest("hex");
5410
5426
  }
5411
5427
  async function collectDirectoryFilePaths(directoryPath, rootDirectoryPath, options) {
5412
5428
  let stack = options.gitignoreStack ?? [];
package/dist/structure.js CHANGED
@@ -795,6 +795,22 @@ var ignoreFactory = require2("ignore");
795
795
  // src/io/hash.ts
796
796
  var require3 = createRequire3(import.meta.url);
797
797
  var ignoreFactory2 = require3("ignore");
798
+ var CR = 13;
799
+ var LF = 10;
800
+ function normalizeLineEndings(bytes) {
801
+ if (!bytes.includes(CR)) return bytes;
802
+ const out = Buffer.allocUnsafe(bytes.length);
803
+ let w = 0;
804
+ for (let i = 0; i < bytes.length; i++) {
805
+ if (bytes[i] === CR) {
806
+ out[w++] = LF;
807
+ if (bytes[i + 1] === LF) i++;
808
+ } else {
809
+ out[w++] = bytes[i];
810
+ }
811
+ }
812
+ return out.subarray(0, w);
813
+ }
798
814
  async function loadRootGitignoreStack2(projectRoot) {
799
815
  if (!projectRoot) return [];
800
816
  try {
@@ -818,7 +834,7 @@ function hashString(content) {
818
834
  return createHash("sha256").update(content).digest("hex");
819
835
  }
820
836
  function hashBytes(bytes) {
821
- return createHash("sha256").update(bytes).digest("hex");
837
+ return createHash("sha256").update(normalizeLineEndings(bytes)).digest("hex");
822
838
  }
823
839
  async function collectDirectoryFilePaths(directoryPath, rootDirectoryPath, options) {
824
840
  let stack = options.gitignoreStack ?? [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chrisdudek/yg",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
4
4
  "description": "Architecture rules your AI coding agent can't ignore. It gets the rules for a file before it edits, and every change is checked — by a free local script or an LLM reviewer — before it moves on. Works with Claude Code, Cursor, Copilot, Codex, Cline.",
5
5
  "type": "module",
6
6
  "bin": {