@interlace/eslint-devkit 1.2.0 → 1.3.0
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/AGENTS.md +99 -300
- package/README.md +4 -3
- package/package.json +2 -3
- package/src/aria-definitions.d.ts +5 -0
- package/src/aria-definitions.js +7 -3
- package/src/ast/ast-utils.d.ts +5 -0
- package/src/ast/ast-utils.js +5 -1
- package/src/ast/index.d.ts +5 -0
- package/src/ast/index.js +5 -1
- package/src/index.d.ts +7 -2
- package/src/index.js +9 -4
- package/src/messaging/config.d.ts +129 -0
- package/src/messaging/config.js +186 -0
- package/src/messaging/constants.d.ts +16 -2
- package/src/messaging/constants.js +62 -6
- package/src/messaging/formatters-ai.d.ts +94 -0
- package/src/messaging/formatters-ai.js +265 -0
- package/src/messaging/formatters.d.ts +5 -0
- package/src/messaging/formatters.js +3 -4
- package/src/messaging/index.d.ts +7 -0
- package/src/messaging/index.js +7 -1
- package/src/messaging/types.d.ts +39 -1
- package/src/messaging/types.js +3 -4
- package/src/node/fs.d.ts +5 -0
- package/src/node/fs.js +5 -1
- package/src/node/index.d.ts +5 -0
- package/src/node/index.js +5 -1
- package/src/node/os.d.ts +5 -0
- package/src/node/os.js +5 -1
- package/src/node/path.d.ts +5 -0
- package/src/node/path.js +5 -1
- package/src/resolver/dependency-analysis.d.ts +5 -0
- package/src/resolver/dependency-analysis.js +5 -1
- package/src/resolver/index.d.ts +5 -0
- package/src/resolver/index.js +5 -1
- package/src/resolver/resolver-adapter.d.ts +5 -0
- package/src/resolver/resolver-adapter.js +5 -1
- package/src/resolver/resolver-detection.d.ts +5 -0
- package/src/resolver/resolver-detection.js +11 -7
- package/src/resolver/resolver.d.ts +5 -0
- package/src/resolver/resolver.js +5 -1
- package/src/resolver.d.ts +5 -0
- package/src/resolver.js +5 -1
- package/src/rule-creation/index.d.ts +5 -0
- package/src/rule-creation/index.js +5 -1
- package/src/rule-creation/rule-creator.d.ts +5 -0
- package/src/rule-creation/rule-creator.js +6 -2
- package/src/security/index.d.ts +5 -0
- package/src/security/index.js +5 -1
- package/src/security/security-utils.d.ts +103 -0
- package/src/security/security-utils.js +163 -2
- package/src/types/index.d.ts +5 -0
- package/src/types/index.js +5 -1
- package/src/types/type-utils.d.ts +5 -0
- package/src/types/type-utils.js +5 -1
- package/src/aria-definitions.js.map +0 -1
- package/src/ast/ast-utils.js.map +0 -1
- package/src/ast/index.js.map +0 -1
- package/src/index.js.map +0 -1
- package/src/messaging/constants.js.map +0 -1
- package/src/messaging/formatters.js.map +0 -1
- package/src/messaging/index.js.map +0 -1
- package/src/messaging/types.js.map +0 -1
- package/src/node/fs.js.map +0 -1
- package/src/node/index.js.map +0 -1
- package/src/node/os.js.map +0 -1
- package/src/node/path.js.map +0 -1
- package/src/resolver/dependency-analysis.js.map +0 -1
- package/src/resolver/index.js.map +0 -1
- package/src/resolver/resolver-adapter.js.map +0 -1
- package/src/resolver/resolver-detection.js.map +0 -1
- package/src/resolver/resolver.js.map +0 -1
- package/src/resolver.js.map +0 -1
- package/src/rule-creation/index.js.map +0 -1
- package/src/rule-creation/rule-creator.js.map +0 -1
- package/src/security/index.js.map +0 -1
- package/src/security/security-utils.js.map +0 -1
- package/src/types/index.js.map +0 -1
- package/src/types/type-utils.js.map +0 -1
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.buildASTSelector = buildASTSelector;
|
|
9
|
+
exports.formatAgentMessage = formatAgentMessage;
|
|
10
|
+
exports.formatMessageNextGen = formatMessageNextGen;
|
|
11
|
+
exports.formatLLMMessageNextGen = formatLLMMessageNextGen;
|
|
12
|
+
const constants_1 = require("./constants");
|
|
13
|
+
const config_1 = require("./config");
|
|
14
|
+
/**
|
|
15
|
+
* Builds a relative esquery selector from an AST node
|
|
16
|
+
* Goes up to the nearest "anchor" (function, class, method) for context
|
|
17
|
+
*
|
|
18
|
+
* @param node - The AST node that triggered the lint error
|
|
19
|
+
* @param maxDepth - Maximum levels to traverse up (default: 3)
|
|
20
|
+
* @returns An esquery-compatible selector string
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* // For a node: db.query('SELECT...')
|
|
25
|
+
* buildASTSelector(node)
|
|
26
|
+
* // Returns: "CallExpression[callee.property.name='query']"
|
|
27
|
+
*
|
|
28
|
+
* // For a node inside a method:
|
|
29
|
+
* buildASTSelector(node)
|
|
30
|
+
* // Returns: "MethodDefinition[key.name='getUser'] CallExpression[callee.name='eval']"
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
function buildASTSelector(node, maxDepth = 3) {
|
|
34
|
+
const parts = [];
|
|
35
|
+
let current = node;
|
|
36
|
+
let depth = 0;
|
|
37
|
+
while (current && depth < maxDepth) {
|
|
38
|
+
const selector = buildNodeSelector(current);
|
|
39
|
+
if (selector) {
|
|
40
|
+
parts.unshift(selector);
|
|
41
|
+
}
|
|
42
|
+
// Stop at anchor nodes (stable reference points)
|
|
43
|
+
if (isAnchorNode(current.type)) {
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
current = current.parent;
|
|
47
|
+
depth++;
|
|
48
|
+
}
|
|
49
|
+
return parts.join(' ');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Builds a selector for a single node
|
|
53
|
+
*/
|
|
54
|
+
function buildNodeSelector(node) {
|
|
55
|
+
switch (node.type) {
|
|
56
|
+
case 'CallExpression':
|
|
57
|
+
if (node.callee?.name) {
|
|
58
|
+
return `CallExpression[callee.name='${node.callee.name}']`;
|
|
59
|
+
}
|
|
60
|
+
if (node.callee?.property?.name) {
|
|
61
|
+
return `CallExpression[callee.property.name='${node.callee.property.name}']`;
|
|
62
|
+
}
|
|
63
|
+
return 'CallExpression';
|
|
64
|
+
case 'MethodDefinition':
|
|
65
|
+
if (node.key?.name) {
|
|
66
|
+
return `MethodDefinition[key.name='${node.key.name}']`;
|
|
67
|
+
}
|
|
68
|
+
return 'MethodDefinition';
|
|
69
|
+
case 'FunctionDeclaration':
|
|
70
|
+
if (node.id?.name) {
|
|
71
|
+
return `FunctionDeclaration[id.name='${node.id.name}']`;
|
|
72
|
+
}
|
|
73
|
+
return 'FunctionDeclaration';
|
|
74
|
+
case 'ClassDeclaration':
|
|
75
|
+
if (node.id?.name) {
|
|
76
|
+
return `ClassDeclaration[id.name='${node.id.name}']`;
|
|
77
|
+
}
|
|
78
|
+
return 'ClassDeclaration';
|
|
79
|
+
case 'VariableDeclarator':
|
|
80
|
+
if (node.id?.name) {
|
|
81
|
+
return `VariableDeclarator[id.name='${node.id.name}']`;
|
|
82
|
+
}
|
|
83
|
+
return 'VariableDeclarator';
|
|
84
|
+
case 'MemberExpression':
|
|
85
|
+
return 'MemberExpression';
|
|
86
|
+
case 'Identifier':
|
|
87
|
+
if (node.name) {
|
|
88
|
+
return `Identifier[name='${node.name}']`;
|
|
89
|
+
}
|
|
90
|
+
return 'Identifier';
|
|
91
|
+
default:
|
|
92
|
+
return node.type;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Checks if a node type is an "anchor" (stable reference point)
|
|
97
|
+
*/
|
|
98
|
+
function isAnchorNode(type) {
|
|
99
|
+
return [
|
|
100
|
+
'FunctionDeclaration',
|
|
101
|
+
'FunctionExpression',
|
|
102
|
+
'ArrowFunctionExpression',
|
|
103
|
+
'MethodDefinition',
|
|
104
|
+
'ClassDeclaration',
|
|
105
|
+
'ClassExpression',
|
|
106
|
+
'Program',
|
|
107
|
+
].includes(type);
|
|
108
|
+
}
|
|
109
|
+
// ============================================================================
|
|
110
|
+
// CWE ENRICHMENT
|
|
111
|
+
// ============================================================================
|
|
112
|
+
/**
|
|
113
|
+
* Auto-enriches options with security benchmark data based on CWE
|
|
114
|
+
*/
|
|
115
|
+
function enrichFromCWE(options) {
|
|
116
|
+
if (!options.cwe)
|
|
117
|
+
return options;
|
|
118
|
+
const cweData = constants_1.CWE_MAPPING[options.cwe];
|
|
119
|
+
if (!cweData)
|
|
120
|
+
return options;
|
|
121
|
+
return {
|
|
122
|
+
...options,
|
|
123
|
+
owasp: options.owasp ?? cweData.owasp,
|
|
124
|
+
cvss: options.cvss ?? cweData.cvss,
|
|
125
|
+
compliance: options.compliance ?? constants_1.CWE_COMPLIANCE_MAPPING[options.cwe],
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
// ============================================================================
|
|
129
|
+
// FORMATTERS
|
|
130
|
+
// ============================================================================
|
|
131
|
+
/**
|
|
132
|
+
* Formats a message as structured JSON for AI Agents
|
|
133
|
+
* Minimizes token usage while retaining strict semantic targeting
|
|
134
|
+
*/
|
|
135
|
+
function formatAgentMessage(options, compress = false) {
|
|
136
|
+
const enriched = enrichFromCWE(options);
|
|
137
|
+
// Compressed keys if enabled (Token Economy)
|
|
138
|
+
if (compress) {
|
|
139
|
+
return JSON.stringify({
|
|
140
|
+
id: enriched.cwe ?? enriched.ruleId,
|
|
141
|
+
s: (0, constants_1.severityToCVSS)(enriched.severity),
|
|
142
|
+
desc: enriched.description,
|
|
143
|
+
fix: enriched.fix,
|
|
144
|
+
ast: options.astSelector,
|
|
145
|
+
refs: [enriched.documentationLink],
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// Verbose structured JSON (Standard Agent Schema)
|
|
149
|
+
return JSON.stringify({
|
|
150
|
+
ruleId: enriched.ruleId ?? enriched.cwe,
|
|
151
|
+
severity: enriched.severity,
|
|
152
|
+
description: enriched.description,
|
|
153
|
+
fixInstruction: enriched.fix,
|
|
154
|
+
astTarget: options.astSelector,
|
|
155
|
+
hints: options.aiHints,
|
|
156
|
+
benchmarks: {
|
|
157
|
+
cwe: enriched.cwe,
|
|
158
|
+
owasp: enriched.owasp,
|
|
159
|
+
cvss: enriched.cvss,
|
|
160
|
+
},
|
|
161
|
+
documentation: enriched.documentationLink,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Formats a human-readable message with optional hidden AI hints
|
|
166
|
+
*/
|
|
167
|
+
function formatHumanMessage(options, includeHints = false) {
|
|
168
|
+
const enriched = enrichFromCWE(options);
|
|
169
|
+
const { icon, cwe, description, severity, fix, documentationLink } = enriched;
|
|
170
|
+
const owasp = enriched.owasp;
|
|
171
|
+
const cvss = enriched.cvss;
|
|
172
|
+
const compliance = enriched.compliance;
|
|
173
|
+
// Build standards reference string
|
|
174
|
+
const standards = [];
|
|
175
|
+
if (cwe)
|
|
176
|
+
standards.push(cwe);
|
|
177
|
+
if (owasp) {
|
|
178
|
+
const owaspCode = owasp.split(':')[0];
|
|
179
|
+
const owaspDetails = constants_1.OWASP_DETAILS[owasp];
|
|
180
|
+
const owaspName = owaspDetails?.name?.split(' ')[0] || '';
|
|
181
|
+
standards.push(`OWASP:${owaspCode}-${owaspName}`);
|
|
182
|
+
}
|
|
183
|
+
if (cvss !== undefined)
|
|
184
|
+
standards.push(`CVSS:${cvss}`);
|
|
185
|
+
const standardsPart = standards.length > 0 ? `${standards.join(' ')} | ` : '';
|
|
186
|
+
const compliancePart = compliance && compliance.length > 0
|
|
187
|
+
? ` [${compliance.slice(0, 4).join(',')}]`
|
|
188
|
+
: '';
|
|
189
|
+
const firstLine = `${icon} ${standardsPart}${description} | ${severity}${compliancePart}`;
|
|
190
|
+
let secondLine = ` Fix: ${fix} | ${documentationLink}`;
|
|
191
|
+
// Inject hidden AI hints for Cursor/Copilot (Hybrid Mode)
|
|
192
|
+
if (includeHints) {
|
|
193
|
+
const agentOptions = options;
|
|
194
|
+
if (agentOptions.astSelector || agentOptions.aiHints) {
|
|
195
|
+
const hints = [
|
|
196
|
+
agentOptions.astSelector ? `Target: ${agentOptions.astSelector}` : '',
|
|
197
|
+
...(agentOptions.aiHints ?? []),
|
|
198
|
+
]
|
|
199
|
+
.filter(Boolean)
|
|
200
|
+
.join('; ');
|
|
201
|
+
secondLine += ` <!-- AI_HINT: ${hints} -->`;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
return `${firstLine}\n${secondLine}`;
|
|
205
|
+
}
|
|
206
|
+
// ============================================================================
|
|
207
|
+
// MAIN ENTRY POINT (Context-Aware)
|
|
208
|
+
// ============================================================================
|
|
209
|
+
/**
|
|
210
|
+
* Context-aware message formatter (Next-Gen)
|
|
211
|
+
*
|
|
212
|
+
* Automatically routes between output formats based on the resolved AI mode:
|
|
213
|
+
* - CLI: Human-readable with emojis and prose
|
|
214
|
+
* - CI: Human-readable (no colors)
|
|
215
|
+
* - IDE_CURSOR: Human-readable + hidden AI hints
|
|
216
|
+
* - AGENT_JSON: Structured JSON for agents
|
|
217
|
+
*
|
|
218
|
+
* @param options - Message options including optional agent hints
|
|
219
|
+
* @param context - ESLint rule context (for accessing settings)
|
|
220
|
+
* @returns Formatted message string
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* // In an ESLint rule
|
|
225
|
+
* context.report({
|
|
226
|
+
* node,
|
|
227
|
+
* message: formatMessageNextGen({
|
|
228
|
+
* icon: '🔒',
|
|
229
|
+
* severity: 'CRITICAL',
|
|
230
|
+
* description: 'SQL Injection',
|
|
231
|
+
* fix: 'Use parameterized queries',
|
|
232
|
+
* astSelector: buildASTSelector(node),
|
|
233
|
+
* }, context),
|
|
234
|
+
* });
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
function formatMessageNextGen(options, context) {
|
|
238
|
+
const mode = (0, config_1.resolveAIMode)(context);
|
|
239
|
+
const compress = (0, config_1.resolveCompression)(context);
|
|
240
|
+
switch (mode) {
|
|
241
|
+
case 'AGENT_JSON':
|
|
242
|
+
return formatAgentMessage(options, compress);
|
|
243
|
+
case 'IDE_CURSOR':
|
|
244
|
+
return formatHumanMessage(options, true);
|
|
245
|
+
case 'CI':
|
|
246
|
+
case 'CLI':
|
|
247
|
+
default:
|
|
248
|
+
return formatHumanMessage(options, false);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
// ============================================================================
|
|
252
|
+
// LEGACY API (Backward compatibility)
|
|
253
|
+
// ============================================================================
|
|
254
|
+
/**
|
|
255
|
+
* @deprecated Use formatMessageNextGen(options, context) instead
|
|
256
|
+
* Legacy formatter that uses global state instead of context
|
|
257
|
+
*/
|
|
258
|
+
function formatLLMMessageNextGen(options) {
|
|
259
|
+
const mode = (0, config_1.getAIMessagingMode)();
|
|
260
|
+
const compress = (0, config_1.isTokenCompressionEnabled)();
|
|
261
|
+
if (mode === 'AGENT_JSON') {
|
|
262
|
+
return formatAgentMessage(options, compress);
|
|
263
|
+
}
|
|
264
|
+
return formatHumanMessage(options, mode === 'IDE_CURSOR');
|
|
265
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.formatLLMMessage = formatLLMMessage;
|
|
@@ -327,4 +327,3 @@ function severityToSARIFLevel(severity) {
|
|
|
327
327
|
return 'none';
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
//# sourceMappingURL=formatters.js.map
|
package/src/messaging/index.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
export * from './types';
|
|
2
7
|
export * from './constants';
|
|
3
8
|
export * from './formatters';
|
|
9
|
+
export * from './config';
|
|
10
|
+
export * from './formatters-ai';
|
package/src/messaging/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
const tslib_1 = require("tslib");
|
|
4
9
|
// LLM message formatting utilities - types, constants, and runtime functions
|
|
5
10
|
tslib_1.__exportStar(require("./types"), exports);
|
|
6
11
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
7
12
|
tslib_1.__exportStar(require("./formatters"), exports);
|
|
8
|
-
|
|
13
|
+
tslib_1.__exportStar(require("./config"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./formatters-ai"), exports);
|
package/src/messaging/types.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* Type definitions for LLM message formatting
|
|
3
8
|
*
|
|
@@ -6,7 +11,12 @@
|
|
|
6
11
|
export type Severity = 'CRITICAL' | 'HIGH' | 'MEDIUM' | 'LOW' | 'INFO';
|
|
7
12
|
export type OWASP2025Category = 'A01:2025' | 'A02:2025' | 'A03:2025' | 'A04:2025' | 'A05:2025' | 'A06:2025' | 'A07:2025' | 'A08:2025' | 'A09:2025' | 'A10:2025';
|
|
8
13
|
export type OWASP2021Category = 'A01:2021' | 'A02:2021' | 'A03:2021' | 'A04:2021' | 'A05:2021' | 'A06:2021' | 'A07:2021' | 'A08:2021' | 'A09:2021' | 'A10:2021';
|
|
9
|
-
|
|
14
|
+
/**
|
|
15
|
+
* OWASP Serverless Top 10 (SAS) Categories
|
|
16
|
+
* @see https://owasp.org/www-project-serverless-top-10/
|
|
17
|
+
*/
|
|
18
|
+
export type OWASPServerlessCategory = 'SAS-1' | 'SAS-2' | 'SAS-3' | 'SAS-4' | 'SAS-5' | 'SAS-6' | 'SAS-7' | 'SAS-8' | 'SAS-9' | 'SAS-10';
|
|
19
|
+
export type OWASPCategory = OWASP2025Category | OWASP2021Category | OWASPServerlessCategory;
|
|
10
20
|
export type ComplianceFramework = 'SOC2' | 'HIPAA' | 'PCI-DSS' | 'GDPR' | 'ISO27001' | 'NIST-CSF' | 'FedRAMP' | 'CCPA';
|
|
11
21
|
/**
|
|
12
22
|
* Basic message options (backward compatible)
|
|
@@ -120,3 +130,31 @@ export interface SARIFResult {
|
|
|
120
130
|
fix?: string;
|
|
121
131
|
};
|
|
122
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Execution environment for message formatting
|
|
135
|
+
* Used to determine the output format (Human vs Agent)
|
|
136
|
+
*/
|
|
137
|
+
export type MessagingEnvironment = 'CLI' | 'CI' | 'IDE_CURSOR' | 'AGENT_JSON';
|
|
138
|
+
/**
|
|
139
|
+
* Options for AI-Native messaging
|
|
140
|
+
* Extends enterprise options with agent-specific fields
|
|
141
|
+
*/
|
|
142
|
+
export interface AgentMessageOptions extends EnterpriseMessageOptions {
|
|
143
|
+
/**
|
|
144
|
+
* Precise AST selector for the issue
|
|
145
|
+
* Guides the agent to the exact code construct to fix
|
|
146
|
+
* @example "CallExpression[callee.name='eval']"
|
|
147
|
+
*/
|
|
148
|
+
astSelector?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Hidden reasoning hints for the agent
|
|
151
|
+
* Embedded as comments or metadata
|
|
152
|
+
*/
|
|
153
|
+
aiHints?: string[];
|
|
154
|
+
/**
|
|
155
|
+
* Difficulty level for the AI to fix
|
|
156
|
+
* 'trivial': Simple search/replace or defined fix
|
|
157
|
+
* 'reasoning_required': Needs context/logic analysis
|
|
158
|
+
*/
|
|
159
|
+
aiDifficulty?: 'trivial' | 'reasoning_required';
|
|
160
|
+
}
|
package/src/messaging/types.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
//# sourceMappingURL=types.js.map
|
package/src/node/fs.d.ts
CHANGED
package/src/node/fs.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.fileExistsSync = fileExistsSync;
|
|
4
9
|
exports.readFileSync = readFileSync;
|
|
@@ -126,4 +131,3 @@ function findFileUpward(filename, startDir) {
|
|
|
126
131
|
}
|
|
127
132
|
return null;
|
|
128
133
|
}
|
|
129
|
-
//# sourceMappingURL=fs.js.map
|
package/src/node/index.d.ts
CHANGED
package/src/node/index.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
const tslib_1 = require("tslib");
|
|
4
9
|
// Node.js utilities for cross-platform compatibility and testability
|
|
5
10
|
tslib_1.__exportStar(require("./fs"), exports);
|
|
6
11
|
tslib_1.__exportStar(require("./os"), exports);
|
|
7
12
|
tslib_1.__exportStar(require("./path"), exports);
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
package/src/node/os.d.ts
CHANGED
package/src/node/os.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.getEOL = getEOL;
|
|
4
9
|
exports.getPlatform = getPlatform;
|
|
@@ -46,4 +51,3 @@ function getArch() {
|
|
|
46
51
|
function getTmpDir() {
|
|
47
52
|
return os.tmpdir();
|
|
48
53
|
}
|
|
49
|
-
//# sourceMappingURL=os.js.map
|
package/src/node/path.d.ts
CHANGED
package/src/node/path.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.createPatternCache = createPatternCache;
|
|
4
9
|
exports.patternToRegex = patternToRegex;
|
|
@@ -206,4 +211,3 @@ function resolvePath(...segments) {
|
|
|
206
211
|
function getExtname(filePath) {
|
|
207
212
|
return path.extname(filePath);
|
|
208
213
|
}
|
|
209
|
-
//# sourceMappingURL=path.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
import { ResolverSetting } from './resolver-adapter';
|
|
2
7
|
import { type PatternCache } from '../node/path';
|
|
3
8
|
/**
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.PERFORMANCE_DOCS = void 0;
|
|
4
9
|
exports.createLRUCache = createLRUCache;
|
|
@@ -931,4 +936,3 @@ exports.PERFORMANCE_DOCS = {
|
|
|
931
936
|
spaceComplexity: 'O(V)',
|
|
932
937
|
guaranteedComplete: true,
|
|
933
938
|
};
|
|
934
|
-
//# sourceMappingURL=dependency-analysis.js.map
|
package/src/resolver/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
export * from './resolver';
|
|
2
7
|
export * from './resolver-adapter';
|
|
3
8
|
export * from './dependency-analysis';
|
package/src/resolver/index.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
const tslib_1 = require("tslib");
|
|
4
9
|
// Resolver and dependency analysis utilities
|
|
@@ -6,4 +11,3 @@ tslib_1.__exportStar(require("./resolver"), exports);
|
|
|
6
11
|
tslib_1.__exportStar(require("./resolver-adapter"), exports);
|
|
7
12
|
tslib_1.__exportStar(require("./dependency-analysis"), exports);
|
|
8
13
|
tslib_1.__exportStar(require("./resolver-detection"), exports);
|
|
9
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
/**
|
|
2
7
|
* Interface for external resolvers (compatible with eslint-plugin-import resolvers)
|
|
3
8
|
*
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.resolveWithExternalResolvers = resolveWithExternalResolvers;
|
|
4
9
|
/**
|
|
@@ -123,4 +128,3 @@ function resolveWithExternalResolvers(source, file, settings) {
|
|
|
123
128
|
}
|
|
124
129
|
return null;
|
|
125
130
|
}
|
|
126
|
-
//# sourceMappingURL=resolver-adapter.js.map
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.detectResolvers = detectResolvers;
|
|
4
9
|
exports.generateRecommendedConfig = generateRecommendedConfig;
|
|
@@ -135,12 +140,12 @@ function migrateFromEslintImport(oldConfig) {
|
|
|
135
140
|
if (ruleName.startsWith('import/')) {
|
|
136
141
|
// Rule mapping
|
|
137
142
|
const ruleMappings = {
|
|
138
|
-
'import/no-unresolved': '
|
|
139
|
-
'import/no-cycle': '
|
|
140
|
-
'import/no-self-import': '
|
|
141
|
-
'import/no-absolute-path': '
|
|
142
|
-
'import/no-dynamic-require': '
|
|
143
|
-
'import/no-webpack-loader-syntax': '
|
|
143
|
+
'import/no-unresolved': 'eslint-plugin-llm-optimized/no-unresolved',
|
|
144
|
+
'import/no-cycle': 'eslint-plugin-llm-optimized/no-circular-dependencies',
|
|
145
|
+
'import/no-self-import': 'eslint-plugin-llm-optimized/no-self-import',
|
|
146
|
+
'import/no-absolute-path': 'eslint-plugin-llm-optimized/no-absolute-path',
|
|
147
|
+
'import/no-dynamic-require': 'eslint-plugin-llm-optimized/no-dynamic-require',
|
|
148
|
+
'import/no-webpack-loader-syntax': 'eslint-plugin-llm-optimized/no-webpack-loader-syntax',
|
|
144
149
|
};
|
|
145
150
|
if (ruleMappings[ruleName]) {
|
|
146
151
|
newRules[ruleMappings[ruleName]] = ruleConfig;
|
|
@@ -216,4 +221,3 @@ function validateResolverConfig(settings) {
|
|
|
216
221
|
warnings,
|
|
217
222
|
};
|
|
218
223
|
}
|
|
219
|
-
//# sourceMappingURL=resolver-detection.js.map
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
3
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
4
|
+
* MIT license that can be found in the LICENSE file.
|
|
5
|
+
*/
|
|
1
6
|
import { ResolverSetting } from './resolver-adapter';
|
|
2
7
|
/**
|
|
3
8
|
* Options for the resolver
|
package/src/resolver/resolver.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
exports.getResolverPerformanceMetrics = getResolverPerformanceMetrics;
|
|
4
9
|
exports.resolveModule = resolveModule;
|
|
@@ -291,4 +296,3 @@ function clearResolverCache() {
|
|
|
291
296
|
// 2. Represent proper defensive programming practices
|
|
292
297
|
// 3. Ensure the resolver never crashes with unhandled exceptions
|
|
293
298
|
// Coverage: Intentionally uncovered as these are edge case error paths
|
|
294
|
-
//# sourceMappingURL=resolver.js.map
|
package/src/resolver.d.ts
CHANGED
package/src/resolver.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
+
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
+
* MIT license that can be found in the LICENSE file.
|
|
6
|
+
*/
|
|
2
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
8
|
const tslib_1 = require("tslib");
|
|
4
9
|
tslib_1.__exportStar(require("./resolver/index"), exports);
|
|
5
|
-
//# sourceMappingURL=resolver.js.map
|