tokless 0.5.0 → 0.5.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/README.en.md +47 -157
- package/README.md +54 -196
- package/bin/tokless.js +10 -5
- package/index.js +2 -0
- package/install.js +10 -3
- package/package.json +4 -2
- package/plugin.json +2 -2
- package/rules/AGENTS.md +6 -6
- package/scripts/bump-version.js +81 -0
- package/scripts/read-guard-hook.js +71 -44
- package/skills/code-skeleton/SKILL.md +5 -5
- package/skills/token-audit/SKILL.md +12 -6
- package/targets/antigravity.js +8 -0
- package/targets/claude-code.js +21 -6
- package/tools/agy-audit/cli.js +78 -24
- package/tools/agy-audit/lib/analyzer.js +133 -14
- package/tools/agy-audit/lib/compare.js +5 -3
- package/tools/agy-audit/lib/formatter.js +85 -28
- package/tools/agy-audit/lib/paths.js +381 -88
- package/tools/agy-audit/lib/project.js +88 -79
- package/tools/repo-skeleton/cli.js +24 -9
- package/tools/repo-skeleton/lib/core/registry.js +15 -1
- package/tools/repo-skeleton/lib/langs/c-family/c-cpp-parser.js +1133 -0
- package/tools/repo-skeleton/lib/langs/c-family/index.js +42 -77
- package/tools/repo-skeleton/lib/langs/javascript/index.js +167 -4
- package/tools/repo-skeleton/lib/skeleton.js +23 -1
|
@@ -9,28 +9,32 @@ const {
|
|
|
9
9
|
stripLeadingAttributesAndAnnotations,
|
|
10
10
|
scanBraceLanguage,
|
|
11
11
|
} = require('../../core/block-anchor');
|
|
12
|
+
const { parseCCpp } = require('./c-cpp-parser');
|
|
12
13
|
|
|
13
14
|
const ID = 'c-family';
|
|
14
|
-
const EXTENSIONS = [
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const EXTENSIONS = [
|
|
16
|
+
'.c',
|
|
17
|
+
'.h',
|
|
18
|
+
'.cpp',
|
|
19
|
+
'.hpp',
|
|
20
|
+
'.cc',
|
|
21
|
+
'.cxx',
|
|
22
|
+
'.c++',
|
|
23
|
+
'.hh',
|
|
24
|
+
'.hxx',
|
|
25
|
+
'.h++',
|
|
26
|
+
'.inl',
|
|
27
|
+
'.inc',
|
|
28
|
+
'.cs',
|
|
29
|
+
];
|
|
17
30
|
const CS_CONTAINERS = new Set(['class', 'struct', 'interface', 'enum', 'record', 'namespace']);
|
|
18
31
|
|
|
19
|
-
function
|
|
20
|
-
if (ext && typeof ext === 'object') {
|
|
21
|
-
options = ext;
|
|
22
|
-
ext = '.c';
|
|
23
|
-
}
|
|
24
|
-
const normalizedExt = String(ext || '.c').toLowerCase();
|
|
25
|
-
const isCs = normalizedExt === '.cs';
|
|
26
|
-
const isHeader = HEADER_EXTS.has(normalizedExt);
|
|
27
|
-
const lineOffset = options.lineOffset || 0;
|
|
28
|
-
|
|
32
|
+
function parseCSharp(lines, lineOffset = 0) {
|
|
29
33
|
const analyzed = preprocessBraceLines(lines, 'c');
|
|
30
34
|
|
|
31
35
|
return scanBraceLanguage(analyzed, {
|
|
32
36
|
lexer: 'c',
|
|
33
|
-
containers:
|
|
37
|
+
containers: CS_CONTAINERS,
|
|
34
38
|
lineOffset,
|
|
35
39
|
onStatementLine({
|
|
36
40
|
analyzed: rows,
|
|
@@ -51,7 +55,7 @@ function parse(lines, ext = '.c', options = {}) {
|
|
|
51
55
|
const inTypeScope =
|
|
52
56
|
activeScope !== null && activeScope.kind !== 'namespace' && activeScope.kind !== 'enum';
|
|
53
57
|
|
|
54
|
-
if (
|
|
58
|
+
if (inTypeScope) {
|
|
55
59
|
const propMatch = core.match(
|
|
56
60
|
/^(?:(?:public|private|protected|internal|static|virtual|override|abstract|sealed|readonly|new|required|unsafe)\s+)+[\w.<>,?\[\]\s]+\s+([A-Za-z_]\w*)\s*(?:\{|=>)/
|
|
57
61
|
);
|
|
@@ -78,31 +82,7 @@ function parse(lines, ext = '.c', options = {}) {
|
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
if (
|
|
82
|
-
const range = findDeclarationRange(rows, lineIdx, 'c');
|
|
83
|
-
if (range.hasBlock || isHeader) {
|
|
84
|
-
const opMatch = core.match(/\b(operator\s*(?:<<|>>|\+|-|\*|\/|%|\^|&|\|)=)/);
|
|
85
|
-
if (opMatch) {
|
|
86
|
-
const signature = buildCompactSignature(
|
|
87
|
-
rows,
|
|
88
|
-
lineIdx,
|
|
89
|
-
range.headerEndIdx,
|
|
90
|
-
range.hasBlock
|
|
91
|
-
);
|
|
92
|
-
items.push({
|
|
93
|
-
kind: inTypeScope ? 'method' : 'function',
|
|
94
|
-
name: opMatch[1].replace(/\s+/g, ''),
|
|
95
|
-
signature,
|
|
96
|
-
startLine: lineIdx + 1 + offset,
|
|
97
|
-
endLine: range.endIdx + 1 + offset,
|
|
98
|
-
depth: scopeStack.length,
|
|
99
|
-
});
|
|
100
|
-
return { jumpToLine: range.endIdx };
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (isHeader || (isCs && activeScope && activeScope.kind === 'interface')) {
|
|
85
|
+
if (activeScope && activeScope.kind === 'interface') {
|
|
106
86
|
const range = findDeclarationRange(rows, lineIdx, 'c');
|
|
107
87
|
if (range.hasBlock) return null;
|
|
108
88
|
|
|
@@ -113,50 +93,21 @@ function parse(lines, ext = '.c', options = {}) {
|
|
|
113
93
|
.join(' ')
|
|
114
94
|
).trim();
|
|
115
95
|
if (!joined.endsWith(';')) return null;
|
|
116
|
-
if (/^(?:typedef|using|friend|extern\s+"C"|template\b[^;]*;$)/.test(joined)) return null;
|
|
117
96
|
|
|
118
|
-
const
|
|
119
|
-
const parenIdx = cleanedProto.indexOf('(');
|
|
97
|
+
const parenIdx = joined.indexOf('(');
|
|
120
98
|
if (parenIdx <= 0) return null;
|
|
121
|
-
const beforeParen =
|
|
99
|
+
const beforeParen = joined.slice(0, parenIdx).trim();
|
|
122
100
|
if (hasTopLevelChar(beforeParen, '=')) return null;
|
|
123
101
|
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
const opProto = beforeParen.match(/\b(operator\s*(?:\(\)|\[\]|[^\s(]+))\s*$/);
|
|
129
|
-
if (opProto) {
|
|
130
|
-
name = opProto[1].replace(/\s+/g, '');
|
|
131
|
-
} else {
|
|
132
|
-
const nm = beforeParen.match(/([~A-Za-z_]\w*)$/);
|
|
133
|
-
if (!nm || DEFAULT_CONTROL_KEYWORDS.has(nm[1])) return null;
|
|
134
|
-
name = nm[1];
|
|
135
|
-
const prefix = beforeParen.slice(0, beforeParen.length - name.length).trim();
|
|
136
|
-
const isCtorOrDtor =
|
|
137
|
-
inTypeScope &&
|
|
138
|
-
activeScope &&
|
|
139
|
-
(name === activeScope.name || name === `~${activeScope.name}`);
|
|
140
|
-
// 陷阱: 头文件宏调用(如 `DECLARE_API(foo);`)无返回类型前缀,必须要求显式返回类型或类构造/析构名才认作函数原型
|
|
141
|
-
if (!prefix && !isCtorOrDtor) return null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const afterCloseIdx = cleanedProto.lastIndexOf(')');
|
|
145
|
-
if (afterCloseIdx === -1) return null;
|
|
146
|
-
const tail = cleanedProto.slice(afterCloseIdx + 1, -1).trim();
|
|
147
|
-
if (
|
|
148
|
-
tail &&
|
|
149
|
-
!/^(?:(?:const|volatile|noexcept(?:\([^)]*\))?|override|final)\s*)*(?:=\s*(?:0|default|delete))?$/.test(
|
|
150
|
-
tail
|
|
151
|
-
)
|
|
152
|
-
) {
|
|
153
|
-
return null;
|
|
154
|
-
}
|
|
102
|
+
const nm = beforeParen.match(/([A-Za-z_]\w*)$/);
|
|
103
|
+
if (!nm || DEFAULT_CONTROL_KEYWORDS.has(nm[1])) return null;
|
|
104
|
+
const prefix = beforeParen.slice(0, beforeParen.length - nm[1].length).trim();
|
|
105
|
+
if (!prefix) return null;
|
|
155
106
|
|
|
156
107
|
const signature = buildCompactSignature(rows, lineIdx, range.headerEndIdx, false);
|
|
157
108
|
items.push({
|
|
158
|
-
kind:
|
|
159
|
-
name,
|
|
109
|
+
kind: 'method',
|
|
110
|
+
name: nm[1],
|
|
160
111
|
signature,
|
|
161
112
|
startLine: lineIdx + 1 + offset,
|
|
162
113
|
endLine: range.endIdx + 1 + offset,
|
|
@@ -170,6 +121,20 @@ function parse(lines, ext = '.c', options = {}) {
|
|
|
170
121
|
});
|
|
171
122
|
}
|
|
172
123
|
|
|
124
|
+
function parse(lines, ext = '.c', options = {}) {
|
|
125
|
+
if (ext && typeof ext === 'object') {
|
|
126
|
+
options = ext;
|
|
127
|
+
ext = '.c';
|
|
128
|
+
}
|
|
129
|
+
const normalizedExt = String(ext || '.c').toLowerCase();
|
|
130
|
+
const lineOffset = options.lineOffset || 0;
|
|
131
|
+
|
|
132
|
+
if (normalizedExt === '.cs') {
|
|
133
|
+
return parseCSharp(lines, lineOffset);
|
|
134
|
+
}
|
|
135
|
+
return parseCCpp(lines, normalizedExt, options);
|
|
136
|
+
}
|
|
137
|
+
|
|
173
138
|
module.exports = {
|
|
174
139
|
id: ID,
|
|
175
140
|
extensions: EXTENSIONS,
|
|
@@ -59,6 +59,136 @@ function findIifeRange(analyzed, startIdx) {
|
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
function parseTestCallBlock(analyzed, startIdx) {
|
|
63
|
+
const startClean = analyzed[startIdx].clean;
|
|
64
|
+
const trimmed = startClean.trim();
|
|
65
|
+
const m = trimmed.match(
|
|
66
|
+
/^(?:await\s+)?(describe|test|it)((?:\.(?:only|skip|concurrent|serial|sequential))*)\s*\(/
|
|
67
|
+
);
|
|
68
|
+
if (!m) return null;
|
|
69
|
+
|
|
70
|
+
const baseFn = m[1];
|
|
71
|
+
const callee = baseFn + (m[2] || '');
|
|
72
|
+
const openParenCol = startClean.indexOf('(', startClean.indexOf(baseFn));
|
|
73
|
+
if (openParenCol === -1) return null;
|
|
74
|
+
|
|
75
|
+
let relParen = 0;
|
|
76
|
+
let relBracket = 0;
|
|
77
|
+
let relBrace = 0;
|
|
78
|
+
let firstCommaLine = -1;
|
|
79
|
+
let firstCommaCol = -1;
|
|
80
|
+
let paramCleanSinceSep = '';
|
|
81
|
+
let bodyOpenLine = -1;
|
|
82
|
+
let bodyDepth = -1;
|
|
83
|
+
let callEndLine = -1;
|
|
84
|
+
|
|
85
|
+
for (let j = startIdx; j < analyzed.length; j++) {
|
|
86
|
+
const cleanLine = analyzed[j].clean;
|
|
87
|
+
const kStart = j === startIdx ? openParenCol : 0;
|
|
88
|
+
let curBraceDepth = analyzed[j].braceStart;
|
|
89
|
+
if (j === startIdx) {
|
|
90
|
+
for (let p = 0; p < kStart; p++) {
|
|
91
|
+
if (cleanLine[p] === '{') curBraceDepth++;
|
|
92
|
+
else if (cleanLine[p] === '}') curBraceDepth = Math.max(0, curBraceDepth - 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
for (let k = kStart; k < cleanLine.length; k++) {
|
|
97
|
+
const ch = cleanLine[k];
|
|
98
|
+
if (ch === '{') curBraceDepth++;
|
|
99
|
+
else if (ch === '}') curBraceDepth = Math.max(0, curBraceDepth - 1);
|
|
100
|
+
|
|
101
|
+
if (j === startIdx && k === openParenCol) {
|
|
102
|
+
relParen = 1;
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (ch === '(') {
|
|
107
|
+
relParen++;
|
|
108
|
+
if (relParen === 2 && relBracket === 0 && relBrace === 0) {
|
|
109
|
+
paramCleanSinceSep += '(';
|
|
110
|
+
}
|
|
111
|
+
} else if (ch === ')') {
|
|
112
|
+
relParen--;
|
|
113
|
+
if (relParen === 0) {
|
|
114
|
+
callEndLine = j;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (relParen === 1 && relBracket === 0 && relBrace === 0) {
|
|
118
|
+
paramCleanSinceSep += ')';
|
|
119
|
+
}
|
|
120
|
+
} else if (ch === '[') {
|
|
121
|
+
relBracket++;
|
|
122
|
+
} else if (ch === ']') {
|
|
123
|
+
relBracket = Math.max(0, relBracket - 1);
|
|
124
|
+
} else if (ch === '{') {
|
|
125
|
+
if (relParen === 1 && relBracket === 0 && relBrace === 0 && bodyOpenLine === -1) {
|
|
126
|
+
const prev = paramCleanSinceSep.trim();
|
|
127
|
+
if (/=>\s*$/.test(prev) || /^(?:async\s+)?function\b/.test(prev)) {
|
|
128
|
+
bodyOpenLine = j;
|
|
129
|
+
bodyDepth = curBraceDepth;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
relBrace++;
|
|
133
|
+
} else if (ch === '}') {
|
|
134
|
+
relBrace = Math.max(0, relBrace - 1);
|
|
135
|
+
} else if (ch === ',' && relParen === 1 && relBracket === 0 && relBrace === 0) {
|
|
136
|
+
if (firstCommaLine === -1) {
|
|
137
|
+
firstCommaLine = j;
|
|
138
|
+
firstCommaCol = k;
|
|
139
|
+
}
|
|
140
|
+
paramCleanSinceSep = '';
|
|
141
|
+
} else if (relParen === 1 && relBracket === 0 && relBrace === 0) {
|
|
142
|
+
paramCleanSinceSep += ch;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (callEndLine !== -1) break;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
if (callEndLine === -1 || bodyOpenLine === -1 || firstCommaLine === -1) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const rawArgChunks = [];
|
|
154
|
+
for (let j = startIdx; j <= firstCommaLine; j++) {
|
|
155
|
+
const rawLine = analyzed[j].raw;
|
|
156
|
+
const from = j === startIdx ? openParenCol + 1 : 0;
|
|
157
|
+
const to = j === firstCommaLine ? firstCommaCol : rawLine.length;
|
|
158
|
+
rawArgChunks.push(rawLine.slice(from, to));
|
|
159
|
+
}
|
|
160
|
+
const firstArgText = rawArgChunks.join(' ').replace(/\s+/g, ' ').trim();
|
|
161
|
+
if (!firstArgText) return null;
|
|
162
|
+
|
|
163
|
+
let label = firstArgText;
|
|
164
|
+
if (
|
|
165
|
+
(label.startsWith("'") && label.endsWith("'") && label.length >= 2) ||
|
|
166
|
+
(label.startsWith('"') && label.endsWith('"') && label.length >= 2) ||
|
|
167
|
+
(label.startsWith('`') && label.endsWith('`') && label.length >= 2)
|
|
168
|
+
) {
|
|
169
|
+
label = label.slice(1, -1);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let displayArg = firstArgText;
|
|
173
|
+
if (displayArg.length > 110) {
|
|
174
|
+
const q = displayArg[0];
|
|
175
|
+
if (q === "'" || q === '"' || q === '`') {
|
|
176
|
+
displayArg = displayArg.slice(0, 106) + '...' + q;
|
|
177
|
+
} else {
|
|
178
|
+
displayArg = displayArg.slice(0, 107) + '...';
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
kind: baseFn === 'describe' ? 'suite' : 'test',
|
|
184
|
+
name: label,
|
|
185
|
+
signature: `${callee}(${displayArg})`,
|
|
186
|
+
headerEndIdx: bodyOpenLine,
|
|
187
|
+
endIdx: callEndLine,
|
|
188
|
+
bodyDepth,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
62
192
|
function parse(lines, ext = '.js', options = {}) {
|
|
63
193
|
if (ext && typeof ext === 'object') {
|
|
64
194
|
options = ext;
|
|
@@ -71,6 +201,7 @@ function parse(lines, ext = '.js', options = {}) {
|
|
|
71
201
|
const analyzed = preprocessBraceLines(lines, 'js');
|
|
72
202
|
const items = [];
|
|
73
203
|
const classStack = [];
|
|
204
|
+
const suiteStack = [];
|
|
74
205
|
let activeIifeEnd = -1;
|
|
75
206
|
let activeIifeBodyDepth = -1;
|
|
76
207
|
|
|
@@ -82,12 +213,20 @@ function parse(lines, ext = '.js', options = {}) {
|
|
|
82
213
|
while (classStack.length > 0 && i > classStack[classStack.length - 1].endIdx) {
|
|
83
214
|
classStack.pop();
|
|
84
215
|
}
|
|
216
|
+
while (suiteStack.length > 0 && i > suiteStack[suiteStack.length - 1].endIdx) {
|
|
217
|
+
suiteStack.pop();
|
|
218
|
+
}
|
|
85
219
|
if (activeIifeEnd !== -1 && i > activeIifeEnd) {
|
|
86
220
|
activeIifeEnd = -1;
|
|
87
221
|
activeIifeBodyDepth = -1;
|
|
88
222
|
}
|
|
89
223
|
|
|
90
|
-
if (
|
|
224
|
+
if (
|
|
225
|
+
info.braceStart === 0 &&
|
|
226
|
+
activeIifeEnd === -1 &&
|
|
227
|
+
classStack.length === 0 &&
|
|
228
|
+
suiteStack.length === 0
|
|
229
|
+
) {
|
|
91
230
|
const iife = findIifeRange(analyzed, i);
|
|
92
231
|
if (iife) {
|
|
93
232
|
activeIifeEnd = iife.endIdx;
|
|
@@ -99,13 +238,37 @@ function parse(lines, ext = '.js', options = {}) {
|
|
|
99
238
|
|
|
100
239
|
const topScopeDepth =
|
|
101
240
|
activeIifeEnd !== -1 && i <= activeIifeEnd ? activeIifeBodyDepth : 0;
|
|
241
|
+
const currentSuite = suiteStack.length > 0 ? suiteStack[suiteStack.length - 1] : null;
|
|
242
|
+
const activeScopeDepth = currentSuite !== null ? currentSuite.bodyDepth : topScopeDepth;
|
|
102
243
|
const currentClass = classStack.length > 0 ? classStack[classStack.length - 1] : null;
|
|
103
244
|
const inClassBody =
|
|
104
245
|
currentClass !== null &&
|
|
105
246
|
i <= currentClass.endIdx &&
|
|
106
247
|
info.braceStart === currentClass.bodyDepth;
|
|
107
248
|
|
|
108
|
-
if (info.braceStart ===
|
|
249
|
+
if (info.braceStart === activeScopeDepth && !inClassBody) {
|
|
250
|
+
const testBlock = parseTestCallBlock(analyzed, i);
|
|
251
|
+
if (testBlock) {
|
|
252
|
+
items.push({
|
|
253
|
+
kind: testBlock.kind,
|
|
254
|
+
name: testBlock.name,
|
|
255
|
+
signature: testBlock.signature,
|
|
256
|
+
startLine: i + 1 + lineOffset,
|
|
257
|
+
endLine: testBlock.endIdx + 1 + lineOffset,
|
|
258
|
+
depth: suiteStack.length,
|
|
259
|
+
});
|
|
260
|
+
if (testBlock.kind === 'suite' && testBlock.headerEndIdx < testBlock.endIdx) {
|
|
261
|
+
suiteStack.push({
|
|
262
|
+
endIdx: testBlock.endIdx,
|
|
263
|
+
bodyDepth: testBlock.bodyDepth,
|
|
264
|
+
});
|
|
265
|
+
i = testBlock.headerEndIdx;
|
|
266
|
+
} else {
|
|
267
|
+
i = testBlock.endIdx;
|
|
268
|
+
}
|
|
269
|
+
continue;
|
|
270
|
+
}
|
|
271
|
+
|
|
109
272
|
let kind = null;
|
|
110
273
|
let name = '';
|
|
111
274
|
let m;
|
|
@@ -217,7 +380,7 @@ function parse(lines, ext = '.js', options = {}) {
|
|
|
217
380
|
signature,
|
|
218
381
|
startLine: i + 1 + lineOffset,
|
|
219
382
|
endLine: range.endIdx + 1 + lineOffset,
|
|
220
|
-
depth:
|
|
383
|
+
depth: suiteStack.length,
|
|
221
384
|
});
|
|
222
385
|
|
|
223
386
|
if (kind === 'class' && range.hasBlock) {
|
|
@@ -268,7 +431,7 @@ function parse(lines, ext = '.js', options = {}) {
|
|
|
268
431
|
signature,
|
|
269
432
|
startLine: i + 1 + lineOffset,
|
|
270
433
|
endLine: range.endIdx + 1 + lineOffset,
|
|
271
|
-
depth: classStack.length,
|
|
434
|
+
depth: suiteStack.length + classStack.length,
|
|
272
435
|
});
|
|
273
436
|
i = range.endIdx;
|
|
274
437
|
continue;
|
|
@@ -14,6 +14,12 @@ const IGNORED_DIRS = new Set([
|
|
|
14
14
|
'.next',
|
|
15
15
|
'target',
|
|
16
16
|
'__pycache__',
|
|
17
|
+
'Objects',
|
|
18
|
+
'Listings',
|
|
19
|
+
'.cache',
|
|
20
|
+
'.clangd',
|
|
21
|
+
'.vs',
|
|
22
|
+
'.idea',
|
|
17
23
|
]);
|
|
18
24
|
|
|
19
25
|
function formatSkeletonItems(result, options = {}) {
|
|
@@ -112,6 +118,16 @@ function scanDirectorySkeleton(dirPath, options = {}) {
|
|
|
112
118
|
? options.depth
|
|
113
119
|
: null;
|
|
114
120
|
const maxDepth = explicitMaxDepth !== null ? explicitMaxDepth : isMap ? 8 : 2;
|
|
121
|
+
const extraExclude = new Set();
|
|
122
|
+
if (Array.isArray(options.exclude) || options.exclude instanceof Set) {
|
|
123
|
+
for (const item of options.exclude) {
|
|
124
|
+
if (typeof item === 'string' && item.trim()) extraExclude.add(item.trim());
|
|
125
|
+
}
|
|
126
|
+
} else if (typeof options.exclude === 'string' && options.exclude.trim()) {
|
|
127
|
+
for (const part of options.exclude.split(',')) {
|
|
128
|
+
if (part.trim()) extraExclude.add(part.trim());
|
|
129
|
+
}
|
|
130
|
+
}
|
|
115
131
|
const root = path.resolve(dirPath);
|
|
116
132
|
const files = [];
|
|
117
133
|
|
|
@@ -127,7 +143,13 @@ function scanDirectorySkeleton(dirPath, options = {}) {
|
|
|
127
143
|
|
|
128
144
|
for (const entry of entries) {
|
|
129
145
|
if (entry.isDirectory()) {
|
|
130
|
-
if (
|
|
146
|
+
if (
|
|
147
|
+
IGNORED_DIRS.has(entry.name) ||
|
|
148
|
+
entry.name.startsWith('cmake-build-') ||
|
|
149
|
+
extraExclude.has(entry.name)
|
|
150
|
+
) {
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
131
153
|
if (currentDepth < maxDepth) {
|
|
132
154
|
walk(path.join(currentDir, entry.name), currentDepth + 1);
|
|
133
155
|
}
|