skill-checker 0.1.6 → 0.1.7

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/cli.js CHANGED
@@ -150,14 +150,23 @@ function enumerateFiles(dirPath, warnings) {
150
150
  content = readFileSync(fullPath, "utf-8");
151
151
  } catch {
152
152
  }
153
- } else if (lstats.size <= 5e7) {
153
+ } else {
154
154
  let fd;
155
155
  try {
156
156
  fd = openSync(fullPath, "r");
157
- const buf = Buffer.alloc(PARTIAL_READ_LIMIT);
158
- const bytesRead = readSync(fd, buf, 0, PARTIAL_READ_LIMIT, 0);
159
- content = buf.slice(0, bytesRead).toString("utf-8");
160
- warnings.push(`Large file partially scanned (first ${PARTIAL_READ_LIMIT} bytes): ${relativePath} (${lstats.size} bytes total)`);
157
+ const headBuf = Buffer.alloc(PARTIAL_READ_LIMIT);
158
+ const headBytesRead = readSync(fd, headBuf, 0, PARTIAL_READ_LIMIT, 0);
159
+ const headContent = headBuf.slice(0, headBytesRead).toString("utf-8");
160
+ const tailOffset = Math.max(0, lstats.size - PARTIAL_READ_LIMIT);
161
+ const tailBuf = Buffer.alloc(PARTIAL_READ_LIMIT);
162
+ const tailBytesRead = readSync(fd, tailBuf, 0, PARTIAL_READ_LIMIT, tailOffset);
163
+ const tailContent = tailBuf.slice(0, tailBytesRead).toString("utf-8");
164
+ content = tailOffset > 0 ? `${headContent}
165
+ /* ... window gap ... */
166
+ ${tailContent}` : headContent;
167
+ warnings.push(
168
+ `Large file window-scanned (head+tail ${PARTIAL_READ_LIMIT} bytes each): ${relativePath} (${lstats.size} bytes total)`
169
+ );
161
170
  } catch {
162
171
  warnings.push(`Large file could not be read: ${relativePath} (${lstats.size} bytes)`);
163
172
  } finally {
@@ -168,8 +177,6 @@ function enumerateFiles(dirPath, warnings) {
168
177
  }
169
178
  }
170
179
  }
171
- } else {
172
- warnings.push(`File too large to scan: ${relativePath} (${lstats.size} bytes). Content not checked.`);
173
180
  }
174
181
  }
175
182
  files.push({