grepmax 0.17.12 → 0.17.14
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.
|
@@ -41,6 +41,29 @@ exports.DEFAULT_IGNORE_PATTERNS = [
|
|
|
41
41
|
"*.min.css",
|
|
42
42
|
"*.map",
|
|
43
43
|
"*.wasm",
|
|
44
|
+
// Machine-generated source (floods the index + ranks codegen as god nodes).
|
|
45
|
+
// Content-based @generated/DO-NOT-EDIT header sniff (file-utils.ts) catches the
|
|
46
|
+
// rest; these are the unambiguous filename/dir conventions.
|
|
47
|
+
"**/__generated__/**", // Relay / graphql-codegen
|
|
48
|
+
"**/Generated/**", // Apollo iOS, Xcode codegen
|
|
49
|
+
"*.graphql.swift", // Apollo iOS operations
|
|
50
|
+
"*.pb.go", // protobuf (Go)
|
|
51
|
+
"*.pb.cc",
|
|
52
|
+
"*.pb.h", // protobuf (C++)
|
|
53
|
+
"*_pb2.py",
|
|
54
|
+
"*_pb2.pyi",
|
|
55
|
+
"*_pb2_grpc.py", // protobuf (Python)
|
|
56
|
+
"*.g.dart",
|
|
57
|
+
"*.freezed.dart",
|
|
58
|
+
"*.gr.dart", // Dart codegen
|
|
59
|
+
"*.designer.cs", // C# designer
|
|
60
|
+
"*.generated.ts",
|
|
61
|
+
"*.generated.tsx", // graphql-codegen / common TS
|
|
62
|
+
// graphql-codegen client-preset output dir (emits no @generated banner, so
|
|
63
|
+
// the header sniff can't catch these — match the canonical filenames).
|
|
64
|
+
"**/gql/graphql.ts",
|
|
65
|
+
"**/gql/gql.ts",
|
|
66
|
+
"**/gql/fragment-masking.ts",
|
|
44
67
|
// Test fixtures and benchmark data
|
|
45
68
|
"**/fixtures/**",
|
|
46
69
|
"**/benchmark/**",
|
|
@@ -47,6 +47,7 @@ exports.hasNullByte = hasNullByte;
|
|
|
47
47
|
exports.readFileSnapshot = readFileSnapshot;
|
|
48
48
|
exports.isIndexableFile = isIndexableFile;
|
|
49
49
|
exports.isIndexablePath = isIndexablePath;
|
|
50
|
+
exports.isGeneratedContent = isGeneratedContent;
|
|
50
51
|
exports.formatDenseSnippet = formatDenseSnippet;
|
|
51
52
|
exports.isDevelopment = isDevelopment;
|
|
52
53
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -111,6 +112,23 @@ function isIndexableFile(filePath, size) {
|
|
|
111
112
|
function isIndexablePath(filePath) {
|
|
112
113
|
return isIndexableFile(filePath);
|
|
113
114
|
}
|
|
115
|
+
// Well-known machine-generated markers emitted at the top of codegen output.
|
|
116
|
+
// Tools (protoc, graphql-codegen, Apollo, Relay, Go `stringer`, OpenAPI, etc.)
|
|
117
|
+
// stamp one of these in a banner comment. Matched against only the first few KB
|
|
118
|
+
// because the banner is always at the very top — this keeps a hand-written
|
|
119
|
+
// "do not edit this section" note deep in a real file from being misclassified.
|
|
120
|
+
const GENERATED_MARKER = /@generated\b|\bDO NOT EDIT\b|Code generated by |auto-?generated by |This (?:file|code) (?:is|was) (?:\w+[ -])?generated|machine generated|@autogenerated\b/i;
|
|
121
|
+
const GENERATED_SNIFF_BYTES = 2048;
|
|
122
|
+
/**
|
|
123
|
+
* Detect machine-generated source by its banner. Generated files flood both the
|
|
124
|
+
* vector index and the symbol graph (codegen types rank as god nodes), so they
|
|
125
|
+
* are skipped at index time. Path globs in `ignore-patterns.ts` catch the
|
|
126
|
+
* obvious filenames; this catches the rest by content.
|
|
127
|
+
*/
|
|
128
|
+
function isGeneratedContent(buffer) {
|
|
129
|
+
const head = buffer.subarray(0, GENERATED_SNIFF_BYTES).toString("utf-8");
|
|
130
|
+
return GENERATED_MARKER.test(head);
|
|
131
|
+
}
|
|
114
132
|
function formatDenseSnippet(text, maxLength = 1500) {
|
|
115
133
|
const clean = text !== null && text !== void 0 ? text : "";
|
|
116
134
|
if (clean.length <= maxLength)
|
|
@@ -252,6 +252,10 @@ class WorkerOrchestrator {
|
|
|
252
252
|
(0, logger_1.debug)("orch", `skip ${input.path} (empty or binary)`);
|
|
253
253
|
return { vectors: [], hash, mtimeMs, size, shouldDelete: true };
|
|
254
254
|
}
|
|
255
|
+
if ((0, file_utils_1.isGeneratedContent)(buffer)) {
|
|
256
|
+
(0, logger_1.debug)("orch", `skip ${input.path} (machine-generated header)`);
|
|
257
|
+
return { vectors: [], hash, mtimeMs, size, shouldDelete: true };
|
|
258
|
+
}
|
|
255
259
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress();
|
|
256
260
|
yield this.ensureReady();
|
|
257
261
|
onProgress === null || onProgress === void 0 ? void 0 : onProgress();
|
package/package.json
CHANGED