@interlace/eslint-devkit 1.8.0 → 1.10.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/package.json +1 -1
- package/src/aria-definitions.js +1 -990
- package/src/ast/ast-utils.js +1 -133
- package/src/ast/index.js +1 -17
- package/src/ast-node-types.js +1 -174
- package/src/index.js +1 -43
- package/src/messaging/config.js +1 -98
- package/src/messaging/constants.js +1 -678
- package/src/messaging/formatters-ai.js +2 -176
- package/src/messaging/formatters-v2.js +10 -212
- package/src/messaging/formatters.js +3 -186
- package/src/messaging/index.js +1 -21
- package/src/messaging/types-v2.js +1 -2
- package/src/messaging/types.js +1 -2
- package/src/node/fs.js +1 -104
- package/src/node/index.js +1 -19
- package/src/node/os.js +1 -52
- package/src/node/path.js +1 -143
- package/src/resolver/dependency-analysis.js +1 -740
- package/src/resolver/index.js +1 -20
- package/src/resolver/resolver-adapter.js +1 -92
- package/src/resolver/resolver-detection.js +1 -189
- package/src/resolver/resolver.js +1 -206
- package/src/resolver.js +1 -17
- package/src/rule-creation/browser-escape-hatch-rule.d.ts +72 -0
- package/src/rule-creation/browser-escape-hatch-rule.js +1 -0
- package/src/rule-creation/hardcoded-credentials-rule.d.ts +81 -0
- package/src/rule-creation/hardcoded-credentials-rule.js +1 -0
- package/src/rule-creation/index.d.ts +6 -0
- package/src/rule-creation/index.js +1 -21
- package/src/rule-creation/mass-assignment-rule.d.ts +79 -0
- package/src/rule-creation/mass-assignment-rule.js +1 -0
- package/src/rule-creation/mock-context.js +1 -39
- package/src/rule-creation/raw-identifier-rule.d.ts +127 -0
- package/src/rule-creation/raw-identifier-rule.js +1 -0
- package/src/rule-creation/require-tls-rule.d.ts +1 -1
- package/src/rule-creation/require-tls-rule.js +1 -190
- package/src/rule-creation/rule-creator.js +1 -70
- package/src/rule-creation/sdk-api-key-rule.d.ts +108 -0
- package/src/rule-creation/sdk-api-key-rule.js +1 -0
- package/src/rule-creation/sql-injection-rule.js +1 -207
- package/src/rule-creation/system-prompt-injection-rule.d.ts +78 -0
- package/src/rule-creation/system-prompt-injection-rule.js +1 -0
- package/src/rule-creation/unscoped-mutation-rule.js +1 -234
- package/src/security/index.js +1 -17
- package/src/security/security-utils.js +1 -461
- package/src/types/index.js +1 -18
- package/src/types/meta-augmentation.js +1 -2
- package/src/types/type-utils.js +1 -222
package/src/ast/ast-utils.js
CHANGED
|
@@ -1,133 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isNodeOfType = isNodeOfType;
|
|
4
|
-
exports.isFunctionNode = isFunctionNode;
|
|
5
|
-
exports.isClassNode = isClassNode;
|
|
6
|
-
exports.isMemberExpression = isMemberExpression;
|
|
7
|
-
exports.getIdentifierName = getIdentifierName;
|
|
8
|
-
exports.isCallExpression = isCallExpression;
|
|
9
|
-
exports.getFunctionName = getFunctionName;
|
|
10
|
-
exports.isInsideNode = isInsideNode;
|
|
11
|
-
exports.getAncestorOfType = getAncestorOfType;
|
|
12
|
-
exports.isLiteral = isLiteral;
|
|
13
|
-
exports.isTemplateLiteral = isTemplateLiteral;
|
|
14
|
-
exports.getStaticValue = getStaticValue;
|
|
15
|
-
exports.extractFunctionSignature = extractFunctionSignature;
|
|
16
|
-
function isNodeOfType(node, type) {
|
|
17
|
-
return node?.type === type;
|
|
18
|
-
}
|
|
19
|
-
function isFunctionNode(node) {
|
|
20
|
-
if (!node)
|
|
21
|
-
return false;
|
|
22
|
-
return (node.type === 'FunctionDeclaration' ||
|
|
23
|
-
node.type === 'FunctionExpression' ||
|
|
24
|
-
node.type === 'ArrowFunctionExpression');
|
|
25
|
-
}
|
|
26
|
-
function isClassNode(node) {
|
|
27
|
-
if (!node)
|
|
28
|
-
return false;
|
|
29
|
-
return node.type === 'ClassDeclaration' || node.type === 'ClassExpression';
|
|
30
|
-
}
|
|
31
|
-
function isMemberExpression(node, objectName, propertyName) {
|
|
32
|
-
if (!node || node.type !== 'MemberExpression') {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
const names = Array.isArray(objectName) ? objectName : [objectName];
|
|
36
|
-
if (names.length > 1) {
|
|
37
|
-
let current = node.object;
|
|
38
|
-
for (let i = names.length - 1; i >= 0; i--) {
|
|
39
|
-
if (i === 0) {
|
|
40
|
-
if (current.type !== 'Identifier' || current.name !== names[0]) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
if (current.type !== 'MemberExpression') {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
if (current.property.type !== 'Identifier' ||
|
|
49
|
-
current.property.name !== names[i]) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
current = current.object;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
if (node.object.type !== 'Identifier' || node.object.name !== names[0]) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (propertyName !== undefined) {
|
|
62
|
-
if (node.property.type !== 'Identifier' ||
|
|
63
|
-
node.property.name !== propertyName) {
|
|
64
|
-
return false;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
function getIdentifierName(node) {
|
|
70
|
-
if (!node || node.type !== 'Identifier') {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
return node.name;
|
|
74
|
-
}
|
|
75
|
-
function isCallExpression(node, objectName, methodName) {
|
|
76
|
-
if (!node || node.type !== 'CallExpression') {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
if (!objectName) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
if (methodName) {
|
|
83
|
-
return isMemberExpression(node.callee, objectName, methodName);
|
|
84
|
-
}
|
|
85
|
-
return getIdentifierName(node.callee) === objectName;
|
|
86
|
-
}
|
|
87
|
-
function getFunctionName(node) {
|
|
88
|
-
return node.id?.name ?? null;
|
|
89
|
-
}
|
|
90
|
-
function isInsideNode(node, parentType, ancestors) {
|
|
91
|
-
return ancestors.some((ancestor) => ancestor.type === parentType);
|
|
92
|
-
}
|
|
93
|
-
function getAncestorOfType(type, ancestors) {
|
|
94
|
-
for (let i = ancestors.length - 1; i >= 0; i--) {
|
|
95
|
-
const ancestor = ancestors[i];
|
|
96
|
-
if (ancestor.type === type) {
|
|
97
|
-
return ancestor;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
function isLiteral(node) {
|
|
103
|
-
return node?.type === 'Literal';
|
|
104
|
-
}
|
|
105
|
-
function isTemplateLiteral(node) {
|
|
106
|
-
return node?.type === 'TemplateLiteral';
|
|
107
|
-
}
|
|
108
|
-
function getStaticValue(node) {
|
|
109
|
-
if (!node) {
|
|
110
|
-
return undefined;
|
|
111
|
-
}
|
|
112
|
-
if (isLiteral(node)) {
|
|
113
|
-
return node.value;
|
|
114
|
-
}
|
|
115
|
-
if (isTemplateLiteral(node) && node.expressions.length === 0) {
|
|
116
|
-
return node.quasis[0]?.value.cooked ?? null;
|
|
117
|
-
}
|
|
118
|
-
return undefined;
|
|
119
|
-
}
|
|
120
|
-
function extractFunctionSignature(node) {
|
|
121
|
-
const params = node.params
|
|
122
|
-
.map((param) => {
|
|
123
|
-
if (param.type === 'Identifier') {
|
|
124
|
-
return param.name;
|
|
125
|
-
}
|
|
126
|
-
return '...';
|
|
127
|
-
})
|
|
128
|
-
.join(', ');
|
|
129
|
-
if (node.type === 'FunctionDeclaration' && node.id) {
|
|
130
|
-
return `function ${node.id.name}(${params})`;
|
|
131
|
-
}
|
|
132
|
-
return `(${params}) => {...}`;
|
|
133
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isNodeOfType=isNodeOfType;exports.isFunctionNode=isFunctionNode;exports.isClassNode=isClassNode;exports.isMemberExpression=isMemberExpression;exports.getIdentifierName=getIdentifierName;exports.isCallExpression=isCallExpression;exports.getFunctionName=getFunctionName;exports.isInsideNode=isInsideNode;exports.getAncestorOfType=getAncestorOfType;exports.isLiteral=isLiteral;exports.isTemplateLiteral=isTemplateLiteral;exports.getStaticValue=getStaticValue;exports.extractFunctionSignature=extractFunctionSignature;function isNodeOfType(node,type){return node?.type===type}function isFunctionNode(node){if(!node)return false;return node.type==="FunctionDeclaration"||node.type==="FunctionExpression"||node.type==="ArrowFunctionExpression"}function isClassNode(node){if(!node)return false;return node.type==="ClassDeclaration"||node.type==="ClassExpression"}function isMemberExpression(node,objectName,propertyName){if(!node||node.type!=="MemberExpression"){return false}const names=Array.isArray(objectName)?objectName:[objectName];if(names.length>1){let current=node.object;for(let i=names.length-1;i>=0;i--){if(i===0){if(current.type!=="Identifier"||current.name!==names[0]){return false}}else{if(current.type!=="MemberExpression"){return false}if(current.property.type!=="Identifier"||current.property.name!==names[i]){return false}current=current.object}}}else{if(node.object.type!=="Identifier"||node.object.name!==names[0]){return false}}if(propertyName!==void 0){if(node.property.type!=="Identifier"||node.property.name!==propertyName){return false}}return true}function getIdentifierName(node){if(!node||node.type!=="Identifier"){return null}return node.name}function isCallExpression(node,objectName,methodName){if(!node||node.type!=="CallExpression"){return false}if(!objectName){return true}if(methodName){return isMemberExpression(node.callee,objectName,methodName)}return getIdentifierName(node.callee)===objectName}function getFunctionName(node){return node.id?.name??null}function isInsideNode(node,parentType,ancestors){return ancestors.some(ancestor=>ancestor.type===parentType)}function getAncestorOfType(type,ancestors){for(let i=ancestors.length-1;i>=0;i--){const ancestor=ancestors[i];if(ancestor.type===type){return ancestor}}return null}function isLiteral(node){return node?.type==="Literal"}function isTemplateLiteral(node){return node?.type==="TemplateLiteral"}function getStaticValue(node){if(!node){return void 0}if(isLiteral(node)){return node.value}if(isTemplateLiteral(node)&&node.expressions.length===0){return node.quasis[0]?.value.cooked??null}return void 0}function extractFunctionSignature(node){const params=node.params.map(param=>{if(param.type==="Identifier"){return param.name}return"..."}).join(", ");if(node.type==="FunctionDeclaration"&&node.id){return`function ${node.id.name}(${params})`}return`(${params}) => {...}`}
|
package/src/ast/index.js
CHANGED
|
@@ -1,17 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("../ast/ast-utils"), exports);
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(o,m,k,k2){if(k2===void 0)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function(){return m[k]}}}Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){if(k2===void 0)k2=k;o[k2]=m[k]}));var __exportStar=this&&this.__exportStar||function(m,exports2){for(var p in m)if(p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p))__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:true});__exportStar(require("../ast/ast-utils"),exports);
|
package/src/ast-node-types.js
CHANGED
|
@@ -1,174 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AST_NODE_TYPES = void 0;
|
|
4
|
-
const AST_NODE_TYPES_VALUES = {
|
|
5
|
-
AccessorProperty: 'AccessorProperty',
|
|
6
|
-
ArrayExpression: 'ArrayExpression',
|
|
7
|
-
ArrayPattern: 'ArrayPattern',
|
|
8
|
-
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
|
9
|
-
AssignmentExpression: 'AssignmentExpression',
|
|
10
|
-
AssignmentPattern: 'AssignmentPattern',
|
|
11
|
-
AwaitExpression: 'AwaitExpression',
|
|
12
|
-
BinaryExpression: 'BinaryExpression',
|
|
13
|
-
BlockStatement: 'BlockStatement',
|
|
14
|
-
BreakStatement: 'BreakStatement',
|
|
15
|
-
CallExpression: 'CallExpression',
|
|
16
|
-
CatchClause: 'CatchClause',
|
|
17
|
-
ChainExpression: 'ChainExpression',
|
|
18
|
-
ClassBody: 'ClassBody',
|
|
19
|
-
ClassDeclaration: 'ClassDeclaration',
|
|
20
|
-
ClassExpression: 'ClassExpression',
|
|
21
|
-
ConditionalExpression: 'ConditionalExpression',
|
|
22
|
-
ContinueStatement: 'ContinueStatement',
|
|
23
|
-
DebuggerStatement: 'DebuggerStatement',
|
|
24
|
-
Decorator: 'Decorator',
|
|
25
|
-
DoWhileStatement: 'DoWhileStatement',
|
|
26
|
-
EmptyStatement: 'EmptyStatement',
|
|
27
|
-
ExportAllDeclaration: 'ExportAllDeclaration',
|
|
28
|
-
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
|
29
|
-
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
|
30
|
-
ExportSpecifier: 'ExportSpecifier',
|
|
31
|
-
ExpressionStatement: 'ExpressionStatement',
|
|
32
|
-
ForInStatement: 'ForInStatement',
|
|
33
|
-
ForOfStatement: 'ForOfStatement',
|
|
34
|
-
ForStatement: 'ForStatement',
|
|
35
|
-
FunctionDeclaration: 'FunctionDeclaration',
|
|
36
|
-
FunctionExpression: 'FunctionExpression',
|
|
37
|
-
Identifier: 'Identifier',
|
|
38
|
-
IfStatement: 'IfStatement',
|
|
39
|
-
ImportAttribute: 'ImportAttribute',
|
|
40
|
-
ImportDeclaration: 'ImportDeclaration',
|
|
41
|
-
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
|
42
|
-
ImportExpression: 'ImportExpression',
|
|
43
|
-
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
|
44
|
-
ImportSpecifier: 'ImportSpecifier',
|
|
45
|
-
JSXAttribute: 'JSXAttribute',
|
|
46
|
-
JSXClosingElement: 'JSXClosingElement',
|
|
47
|
-
JSXClosingFragment: 'JSXClosingFragment',
|
|
48
|
-
JSXElement: 'JSXElement',
|
|
49
|
-
JSXEmptyExpression: 'JSXEmptyExpression',
|
|
50
|
-
JSXExpressionContainer: 'JSXExpressionContainer',
|
|
51
|
-
JSXFragment: 'JSXFragment',
|
|
52
|
-
JSXIdentifier: 'JSXIdentifier',
|
|
53
|
-
JSXMemberExpression: 'JSXMemberExpression',
|
|
54
|
-
JSXNamespacedName: 'JSXNamespacedName',
|
|
55
|
-
JSXOpeningElement: 'JSXOpeningElement',
|
|
56
|
-
JSXOpeningFragment: 'JSXOpeningFragment',
|
|
57
|
-
JSXSpreadAttribute: 'JSXSpreadAttribute',
|
|
58
|
-
JSXSpreadChild: 'JSXSpreadChild',
|
|
59
|
-
JSXText: 'JSXText',
|
|
60
|
-
LabeledStatement: 'LabeledStatement',
|
|
61
|
-
Literal: 'Literal',
|
|
62
|
-
LogicalExpression: 'LogicalExpression',
|
|
63
|
-
MemberExpression: 'MemberExpression',
|
|
64
|
-
MetaProperty: 'MetaProperty',
|
|
65
|
-
MethodDefinition: 'MethodDefinition',
|
|
66
|
-
NewExpression: 'NewExpression',
|
|
67
|
-
ObjectExpression: 'ObjectExpression',
|
|
68
|
-
ObjectPattern: 'ObjectPattern',
|
|
69
|
-
PrivateIdentifier: 'PrivateIdentifier',
|
|
70
|
-
Program: 'Program',
|
|
71
|
-
Property: 'Property',
|
|
72
|
-
PropertyDefinition: 'PropertyDefinition',
|
|
73
|
-
RestElement: 'RestElement',
|
|
74
|
-
ReturnStatement: 'ReturnStatement',
|
|
75
|
-
SequenceExpression: 'SequenceExpression',
|
|
76
|
-
SpreadElement: 'SpreadElement',
|
|
77
|
-
StaticBlock: 'StaticBlock',
|
|
78
|
-
Super: 'Super',
|
|
79
|
-
SwitchCase: 'SwitchCase',
|
|
80
|
-
SwitchStatement: 'SwitchStatement',
|
|
81
|
-
TSAbstractAccessorProperty: 'TSAbstractAccessorProperty',
|
|
82
|
-
TSAbstractKeyword: 'TSAbstractKeyword',
|
|
83
|
-
TSAbstractMethodDefinition: 'TSAbstractMethodDefinition',
|
|
84
|
-
TSAbstractPropertyDefinition: 'TSAbstractPropertyDefinition',
|
|
85
|
-
TSAnyKeyword: 'TSAnyKeyword',
|
|
86
|
-
TSArrayType: 'TSArrayType',
|
|
87
|
-
TSAsExpression: 'TSAsExpression',
|
|
88
|
-
TSAsyncKeyword: 'TSAsyncKeyword',
|
|
89
|
-
TSBigIntKeyword: 'TSBigIntKeyword',
|
|
90
|
-
TSBooleanKeyword: 'TSBooleanKeyword',
|
|
91
|
-
TSCallSignatureDeclaration: 'TSCallSignatureDeclaration',
|
|
92
|
-
TSClassImplements: 'TSClassImplements',
|
|
93
|
-
TSConditionalType: 'TSConditionalType',
|
|
94
|
-
TSConstructSignatureDeclaration: 'TSConstructSignatureDeclaration',
|
|
95
|
-
TSConstructorType: 'TSConstructorType',
|
|
96
|
-
TSDeclareFunction: 'TSDeclareFunction',
|
|
97
|
-
TSDeclareKeyword: 'TSDeclareKeyword',
|
|
98
|
-
TSEmptyBodyFunctionExpression: 'TSEmptyBodyFunctionExpression',
|
|
99
|
-
TSEnumBody: 'TSEnumBody',
|
|
100
|
-
TSEnumDeclaration: 'TSEnumDeclaration',
|
|
101
|
-
TSEnumMember: 'TSEnumMember',
|
|
102
|
-
TSExportAssignment: 'TSExportAssignment',
|
|
103
|
-
TSExportKeyword: 'TSExportKeyword',
|
|
104
|
-
TSExternalModuleReference: 'TSExternalModuleReference',
|
|
105
|
-
TSFunctionType: 'TSFunctionType',
|
|
106
|
-
TSImportEqualsDeclaration: 'TSImportEqualsDeclaration',
|
|
107
|
-
TSImportType: 'TSImportType',
|
|
108
|
-
TSIndexSignature: 'TSIndexSignature',
|
|
109
|
-
TSIndexedAccessType: 'TSIndexedAccessType',
|
|
110
|
-
TSInferType: 'TSInferType',
|
|
111
|
-
TSInstantiationExpression: 'TSInstantiationExpression',
|
|
112
|
-
TSInterfaceBody: 'TSInterfaceBody',
|
|
113
|
-
TSInterfaceDeclaration: 'TSInterfaceDeclaration',
|
|
114
|
-
TSInterfaceHeritage: 'TSInterfaceHeritage',
|
|
115
|
-
TSIntersectionType: 'TSIntersectionType',
|
|
116
|
-
TSIntrinsicKeyword: 'TSIntrinsicKeyword',
|
|
117
|
-
TSLiteralType: 'TSLiteralType',
|
|
118
|
-
TSMappedType: 'TSMappedType',
|
|
119
|
-
TSMethodSignature: 'TSMethodSignature',
|
|
120
|
-
TSModuleBlock: 'TSModuleBlock',
|
|
121
|
-
TSModuleDeclaration: 'TSModuleDeclaration',
|
|
122
|
-
TSNamedTupleMember: 'TSNamedTupleMember',
|
|
123
|
-
TSNamespaceExportDeclaration: 'TSNamespaceExportDeclaration',
|
|
124
|
-
TSNeverKeyword: 'TSNeverKeyword',
|
|
125
|
-
TSNonNullExpression: 'TSNonNullExpression',
|
|
126
|
-
TSNullKeyword: 'TSNullKeyword',
|
|
127
|
-
TSNumberKeyword: 'TSNumberKeyword',
|
|
128
|
-
TSObjectKeyword: 'TSObjectKeyword',
|
|
129
|
-
TSOptionalType: 'TSOptionalType',
|
|
130
|
-
TSParameterProperty: 'TSParameterProperty',
|
|
131
|
-
TSPrivateKeyword: 'TSPrivateKeyword',
|
|
132
|
-
TSPropertySignature: 'TSPropertySignature',
|
|
133
|
-
TSProtectedKeyword: 'TSProtectedKeyword',
|
|
134
|
-
TSPublicKeyword: 'TSPublicKeyword',
|
|
135
|
-
TSQualifiedName: 'TSQualifiedName',
|
|
136
|
-
TSReadonlyKeyword: 'TSReadonlyKeyword',
|
|
137
|
-
TSRestType: 'TSRestType',
|
|
138
|
-
TSSatisfiesExpression: 'TSSatisfiesExpression',
|
|
139
|
-
TSStaticKeyword: 'TSStaticKeyword',
|
|
140
|
-
TSStringKeyword: 'TSStringKeyword',
|
|
141
|
-
TSSymbolKeyword: 'TSSymbolKeyword',
|
|
142
|
-
TSTemplateLiteralType: 'TSTemplateLiteralType',
|
|
143
|
-
TSThisType: 'TSThisType',
|
|
144
|
-
TSTupleType: 'TSTupleType',
|
|
145
|
-
TSTypeAliasDeclaration: 'TSTypeAliasDeclaration',
|
|
146
|
-
TSTypeAnnotation: 'TSTypeAnnotation',
|
|
147
|
-
TSTypeAssertion: 'TSTypeAssertion',
|
|
148
|
-
TSTypeLiteral: 'TSTypeLiteral',
|
|
149
|
-
TSTypeOperator: 'TSTypeOperator',
|
|
150
|
-
TSTypeParameter: 'TSTypeParameter',
|
|
151
|
-
TSTypeParameterDeclaration: 'TSTypeParameterDeclaration',
|
|
152
|
-
TSTypeParameterInstantiation: 'TSTypeParameterInstantiation',
|
|
153
|
-
TSTypePredicate: 'TSTypePredicate',
|
|
154
|
-
TSTypeQuery: 'TSTypeQuery',
|
|
155
|
-
TSTypeReference: 'TSTypeReference',
|
|
156
|
-
TSUndefinedKeyword: 'TSUndefinedKeyword',
|
|
157
|
-
TSUnionType: 'TSUnionType',
|
|
158
|
-
TSUnknownKeyword: 'TSUnknownKeyword',
|
|
159
|
-
TSVoidKeyword: 'TSVoidKeyword',
|
|
160
|
-
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
|
161
|
-
TemplateElement: 'TemplateElement',
|
|
162
|
-
TemplateLiteral: 'TemplateLiteral',
|
|
163
|
-
ThisExpression: 'ThisExpression',
|
|
164
|
-
ThrowStatement: 'ThrowStatement',
|
|
165
|
-
TryStatement: 'TryStatement',
|
|
166
|
-
UnaryExpression: 'UnaryExpression',
|
|
167
|
-
UpdateExpression: 'UpdateExpression',
|
|
168
|
-
VariableDeclaration: 'VariableDeclaration',
|
|
169
|
-
VariableDeclarator: 'VariableDeclarator',
|
|
170
|
-
WhileStatement: 'WhileStatement',
|
|
171
|
-
WithStatement: 'WithStatement',
|
|
172
|
-
YieldExpression: 'YieldExpression',
|
|
173
|
-
};
|
|
174
|
-
exports.AST_NODE_TYPES = AST_NODE_TYPES_VALUES;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AST_NODE_TYPES=void 0;const AST_NODE_TYPES_VALUES={AccessorProperty:"AccessorProperty",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",AssignmentExpression:"AssignmentExpression",AssignmentPattern:"AssignmentPattern",AwaitExpression:"AwaitExpression",BinaryExpression:"BinaryExpression",BlockStatement:"BlockStatement",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ChainExpression:"ChainExpression",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",Decorator:"Decorator",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportAllDeclaration:"ExportAllDeclaration",ExportDefaultDeclaration:"ExportDefaultDeclaration",ExportNamedDeclaration:"ExportNamedDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",ForStatement:"ForStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportAttribute:"ImportAttribute",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportExpression:"ImportExpression",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",JSXAttribute:"JSXAttribute",JSXClosingElement:"JSXClosingElement",JSXClosingFragment:"JSXClosingFragment",JSXElement:"JSXElement",JSXEmptyExpression:"JSXEmptyExpression",JSXExpressionContainer:"JSXExpressionContainer",JSXFragment:"JSXFragment",JSXIdentifier:"JSXIdentifier",JSXMemberExpression:"JSXMemberExpression",JSXNamespacedName:"JSXNamespacedName",JSXOpeningElement:"JSXOpeningElement",JSXOpeningFragment:"JSXOpeningFragment",JSXSpreadAttribute:"JSXSpreadAttribute",JSXSpreadChild:"JSXSpreadChild",JSXText:"JSXText",LabeledStatement:"LabeledStatement",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MetaProperty:"MetaProperty",MethodDefinition:"MethodDefinition",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",PrivateIdentifier:"PrivateIdentifier",Program:"Program",Property:"Property",PropertyDefinition:"PropertyDefinition",RestElement:"RestElement",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",StaticBlock:"StaticBlock",Super:"Super",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TSAbstractAccessorProperty:"TSAbstractAccessorProperty",TSAbstractKeyword:"TSAbstractKeyword",TSAbstractMethodDefinition:"TSAbstractMethodDefinition",TSAbstractPropertyDefinition:"TSAbstractPropertyDefinition",TSAnyKeyword:"TSAnyKeyword",TSArrayType:"TSArrayType",TSAsExpression:"TSAsExpression",TSAsyncKeyword:"TSAsyncKeyword",TSBigIntKeyword:"TSBigIntKeyword",TSBooleanKeyword:"TSBooleanKeyword",TSCallSignatureDeclaration:"TSCallSignatureDeclaration",TSClassImplements:"TSClassImplements",TSConditionalType:"TSConditionalType",TSConstructSignatureDeclaration:"TSConstructSignatureDeclaration",TSConstructorType:"TSConstructorType",TSDeclareFunction:"TSDeclareFunction",TSDeclareKeyword:"TSDeclareKeyword",TSEmptyBodyFunctionExpression:"TSEmptyBodyFunctionExpression",TSEnumBody:"TSEnumBody",TSEnumDeclaration:"TSEnumDeclaration",TSEnumMember:"TSEnumMember",TSExportAssignment:"TSExportAssignment",TSExportKeyword:"TSExportKeyword",TSExternalModuleReference:"TSExternalModuleReference",TSFunctionType:"TSFunctionType",TSImportEqualsDeclaration:"TSImportEqualsDeclaration",TSImportType:"TSImportType",TSIndexSignature:"TSIndexSignature",TSIndexedAccessType:"TSIndexedAccessType",TSInferType:"TSInferType",TSInstantiationExpression:"TSInstantiationExpression",TSInterfaceBody:"TSInterfaceBody",TSInterfaceDeclaration:"TSInterfaceDeclaration",TSInterfaceHeritage:"TSInterfaceHeritage",TSIntersectionType:"TSIntersectionType",TSIntrinsicKeyword:"TSIntrinsicKeyword",TSLiteralType:"TSLiteralType",TSMappedType:"TSMappedType",TSMethodSignature:"TSMethodSignature",TSModuleBlock:"TSModuleBlock",TSModuleDeclaration:"TSModuleDeclaration",TSNamedTupleMember:"TSNamedTupleMember",TSNamespaceExportDeclaration:"TSNamespaceExportDeclaration",TSNeverKeyword:"TSNeverKeyword",TSNonNullExpression:"TSNonNullExpression",TSNullKeyword:"TSNullKeyword",TSNumberKeyword:"TSNumberKeyword",TSObjectKeyword:"TSObjectKeyword",TSOptionalType:"TSOptionalType",TSParameterProperty:"TSParameterProperty",TSPrivateKeyword:"TSPrivateKeyword",TSPropertySignature:"TSPropertySignature",TSProtectedKeyword:"TSProtectedKeyword",TSPublicKeyword:"TSPublicKeyword",TSQualifiedName:"TSQualifiedName",TSReadonlyKeyword:"TSReadonlyKeyword",TSRestType:"TSRestType",TSSatisfiesExpression:"TSSatisfiesExpression",TSStaticKeyword:"TSStaticKeyword",TSStringKeyword:"TSStringKeyword",TSSymbolKeyword:"TSSymbolKeyword",TSTemplateLiteralType:"TSTemplateLiteralType",TSThisType:"TSThisType",TSTupleType:"TSTupleType",TSTypeAliasDeclaration:"TSTypeAliasDeclaration",TSTypeAnnotation:"TSTypeAnnotation",TSTypeAssertion:"TSTypeAssertion",TSTypeLiteral:"TSTypeLiteral",TSTypeOperator:"TSTypeOperator",TSTypeParameter:"TSTypeParameter",TSTypeParameterDeclaration:"TSTypeParameterDeclaration",TSTypeParameterInstantiation:"TSTypeParameterInstantiation",TSTypePredicate:"TSTypePredicate",TSTypeQuery:"TSTypeQuery",TSTypeReference:"TSTypeReference",TSUndefinedKeyword:"TSUndefinedKeyword",TSUnionType:"TSUnionType",TSUnknownKeyword:"TSUnknownKeyword",TSVoidKeyword:"TSVoidKeyword",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};exports.AST_NODE_TYPES=AST_NODE_TYPES_VALUES;
|
package/src/index.js
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.ESLintUtils = exports.AST_NODE_TYPES = exports.toSARIF = exports.severityToCVSS = exports.getSecurityBenchmarks = exports.MessageIcons = exports.OWASP_2021_TO_2025 = exports.OWASP_SERVERLESS_DETAILS = exports.OWASP_2021_DETAILS = exports.OWASP_2025_DETAILS = exports.OWASP_DETAILS = exports.CWE_COMPLIANCE_MAPPING = exports.CWE_MAPPING = exports.CVSS_RANGES = void 0;
|
|
18
|
-
require("./types/meta-augmentation");
|
|
19
|
-
__exportStar(require("./rule-creation"), exports);
|
|
20
|
-
__exportStar(require("./ast/ast-utils"), exports);
|
|
21
|
-
__exportStar(require("./types/type-utils"), exports);
|
|
22
|
-
__exportStar(require("./messaging"), exports);
|
|
23
|
-
__exportStar(require("./security"), exports);
|
|
24
|
-
__exportStar(require("./node"), exports);
|
|
25
|
-
__exportStar(require("./resolver"), exports);
|
|
26
|
-
__exportStar(require("./aria-definitions"), exports);
|
|
27
|
-
var messaging_1 = require("./messaging");
|
|
28
|
-
Object.defineProperty(exports, "CVSS_RANGES", { enumerable: true, get: function () { return messaging_1.CVSS_RANGES; } });
|
|
29
|
-
Object.defineProperty(exports, "CWE_MAPPING", { enumerable: true, get: function () { return messaging_1.CWE_MAPPING; } });
|
|
30
|
-
Object.defineProperty(exports, "CWE_COMPLIANCE_MAPPING", { enumerable: true, get: function () { return messaging_1.CWE_COMPLIANCE_MAPPING; } });
|
|
31
|
-
Object.defineProperty(exports, "OWASP_DETAILS", { enumerable: true, get: function () { return messaging_1.OWASP_DETAILS; } });
|
|
32
|
-
Object.defineProperty(exports, "OWASP_2025_DETAILS", { enumerable: true, get: function () { return messaging_1.OWASP_2025_DETAILS; } });
|
|
33
|
-
Object.defineProperty(exports, "OWASP_2021_DETAILS", { enumerable: true, get: function () { return messaging_1.OWASP_2021_DETAILS; } });
|
|
34
|
-
Object.defineProperty(exports, "OWASP_SERVERLESS_DETAILS", { enumerable: true, get: function () { return messaging_1.OWASP_SERVERLESS_DETAILS; } });
|
|
35
|
-
Object.defineProperty(exports, "OWASP_2021_TO_2025", { enumerable: true, get: function () { return messaging_1.OWASP_2021_TO_2025; } });
|
|
36
|
-
Object.defineProperty(exports, "MessageIcons", { enumerable: true, get: function () { return messaging_1.MessageIcons; } });
|
|
37
|
-
Object.defineProperty(exports, "getSecurityBenchmarks", { enumerable: true, get: function () { return messaging_1.getSecurityBenchmarks; } });
|
|
38
|
-
Object.defineProperty(exports, "severityToCVSS", { enumerable: true, get: function () { return messaging_1.severityToCVSS; } });
|
|
39
|
-
Object.defineProperty(exports, "toSARIF", { enumerable: true, get: function () { return messaging_1.toSARIF; } });
|
|
40
|
-
var ast_node_types_1 = require("./ast-node-types");
|
|
41
|
-
Object.defineProperty(exports, "AST_NODE_TYPES", { enumerable: true, get: function () { return ast_node_types_1.AST_NODE_TYPES; } });
|
|
42
|
-
var rule_creator_1 = require("./rule-creation/rule-creator");
|
|
43
|
-
Object.defineProperty(exports, "ESLintUtils", { enumerable: true, get: function () { return rule_creator_1.ESLintUtils; } });
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?(function(o,m,k,k2){if(k2===void 0)k2=k;var desc=Object.getOwnPropertyDescriptor(m,k);if(!desc||("get"in desc?!m.__esModule:desc.writable||desc.configurable)){desc={enumerable:true,get:function(){return m[k]}}}Object.defineProperty(o,k2,desc)}):(function(o,m,k,k2){if(k2===void 0)k2=k;o[k2]=m[k]}));var __exportStar=this&&this.__exportStar||function(m,exports2){for(var p in m)if(p!=="default"&&!Object.prototype.hasOwnProperty.call(exports2,p))__createBinding(exports2,m,p)};Object.defineProperty(exports,"__esModule",{value:true});exports.ESLintUtils=exports.AST_NODE_TYPES=exports.toSARIF=exports.severityToCVSS=exports.getSecurityBenchmarks=exports.MessageIcons=exports.OWASP_2021_TO_2025=exports.OWASP_SERVERLESS_DETAILS=exports.OWASP_2021_DETAILS=exports.OWASP_2025_DETAILS=exports.OWASP_DETAILS=exports.CWE_COMPLIANCE_MAPPING=exports.CWE_MAPPING=exports.CVSS_RANGES=void 0;require("./types/meta-augmentation");__exportStar(require("./rule-creation"),exports);__exportStar(require("./ast/ast-utils"),exports);__exportStar(require("./types/type-utils"),exports);__exportStar(require("./messaging"),exports);__exportStar(require("./security"),exports);__exportStar(require("./node"),exports);__exportStar(require("./resolver"),exports);__exportStar(require("./aria-definitions"),exports);var messaging_1=require("./messaging");Object.defineProperty(exports,"CVSS_RANGES",{enumerable:true,get:function(){return messaging_1.CVSS_RANGES}});Object.defineProperty(exports,"CWE_MAPPING",{enumerable:true,get:function(){return messaging_1.CWE_MAPPING}});Object.defineProperty(exports,"CWE_COMPLIANCE_MAPPING",{enumerable:true,get:function(){return messaging_1.CWE_COMPLIANCE_MAPPING}});Object.defineProperty(exports,"OWASP_DETAILS",{enumerable:true,get:function(){return messaging_1.OWASP_DETAILS}});Object.defineProperty(exports,"OWASP_2025_DETAILS",{enumerable:true,get:function(){return messaging_1.OWASP_2025_DETAILS}});Object.defineProperty(exports,"OWASP_2021_DETAILS",{enumerable:true,get:function(){return messaging_1.OWASP_2021_DETAILS}});Object.defineProperty(exports,"OWASP_SERVERLESS_DETAILS",{enumerable:true,get:function(){return messaging_1.OWASP_SERVERLESS_DETAILS}});Object.defineProperty(exports,"OWASP_2021_TO_2025",{enumerable:true,get:function(){return messaging_1.OWASP_2021_TO_2025}});Object.defineProperty(exports,"MessageIcons",{enumerable:true,get:function(){return messaging_1.MessageIcons}});Object.defineProperty(exports,"getSecurityBenchmarks",{enumerable:true,get:function(){return messaging_1.getSecurityBenchmarks}});Object.defineProperty(exports,"severityToCVSS",{enumerable:true,get:function(){return messaging_1.severityToCVSS}});Object.defineProperty(exports,"toSARIF",{enumerable:true,get:function(){return messaging_1.toSARIF}});var ast_node_types_1=require("./ast-node-types");Object.defineProperty(exports,"AST_NODE_TYPES",{enumerable:true,get:function(){return ast_node_types_1.AST_NODE_TYPES}});var rule_creator_1=require("./rule-creation/rule-creator");Object.defineProperty(exports,"ESLintUtils",{enumerable:true,get:function(){return rule_creator_1.ESLintUtils}});
|
package/src/messaging/config.js
CHANGED
|
@@ -1,98 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.KNOWN_AGENT_ENVIRONMENTS = void 0;
|
|
4
|
-
exports.detectKnownAgentEnvironment = detectKnownAgentEnvironment;
|
|
5
|
-
exports.resolveAIMode = resolveAIMode;
|
|
6
|
-
exports.resolveCompression = resolveCompression;
|
|
7
|
-
exports.setAIMessagingMode = setAIMessagingMode;
|
|
8
|
-
exports.getAIMessagingMode = getAIMessagingMode;
|
|
9
|
-
exports.setTokenCompression = setTokenCompression;
|
|
10
|
-
exports.isTokenCompressionEnabled = isTokenCompressionEnabled;
|
|
11
|
-
exports.resetGlobalAIConfig = resetGlobalAIConfig;
|
|
12
|
-
exports.KNOWN_AGENT_ENVIRONMENTS = {
|
|
13
|
-
CURSOR: {
|
|
14
|
-
envVar: 'CURSOR_AGENT',
|
|
15
|
-
mode: 'IDE_CURSOR',
|
|
16
|
-
description: 'Cursor IDE AI Agent',
|
|
17
|
-
},
|
|
18
|
-
GITHUB_COPILOT: {
|
|
19
|
-
envVar: 'GITHUB_COPILOT_WORKSPACE',
|
|
20
|
-
mode: 'AGENT_JSON',
|
|
21
|
-
description: 'GitHub Copilot Workspace',
|
|
22
|
-
},
|
|
23
|
-
ANTHROPIC_MCP: {
|
|
24
|
-
envVar: 'ANTHROPIC_MCP',
|
|
25
|
-
mode: 'AGENT_JSON',
|
|
26
|
-
description: 'Anthropic Model Context Protocol',
|
|
27
|
-
},
|
|
28
|
-
OPENAI_AGENT: {
|
|
29
|
-
envVar: 'OPENAI_AGENT',
|
|
30
|
-
mode: 'AGENT_JSON',
|
|
31
|
-
description: 'OpenAI Agent / Code Interpreter',
|
|
32
|
-
},
|
|
33
|
-
GENERIC_AI: {
|
|
34
|
-
envVar: 'AI_AGENT',
|
|
35
|
-
mode: 'AGENT_JSON',
|
|
36
|
-
description: 'Generic AI Agent (set AI_AGENT=true)',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
const GLOBAL_AI_CONFIG = {
|
|
40
|
-
mode: 'CLI',
|
|
41
|
-
compression: false,
|
|
42
|
-
};
|
|
43
|
-
function detectKnownAgentEnvironment() {
|
|
44
|
-
for (const env of Object.values(exports.KNOWN_AGENT_ENVIRONMENTS)) {
|
|
45
|
-
if (process.env[env.envVar]) {
|
|
46
|
-
return env.mode;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
function detectEnvironmentFromEnv() {
|
|
52
|
-
if (process.env['ESLINT_AI_MODE']) {
|
|
53
|
-
return process.env['ESLINT_AI_MODE'];
|
|
54
|
-
}
|
|
55
|
-
const detected = detectKnownAgentEnvironment();
|
|
56
|
-
if (detected)
|
|
57
|
-
return detected;
|
|
58
|
-
if (process.env['CI'])
|
|
59
|
-
return 'CI';
|
|
60
|
-
return 'CLI';
|
|
61
|
-
}
|
|
62
|
-
GLOBAL_AI_CONFIG.mode = detectEnvironmentFromEnv();
|
|
63
|
-
function resolveAIMode(context) {
|
|
64
|
-
if (process.env['ESLINT_AI_MODE']) {
|
|
65
|
-
return process.env['ESLINT_AI_MODE'];
|
|
66
|
-
}
|
|
67
|
-
if (context?.settings?.['interlace/ai-mode']) {
|
|
68
|
-
return context.settings['interlace/ai-mode'];
|
|
69
|
-
}
|
|
70
|
-
if (context?.settings?.['interlace/enableAutoAgentDetection'] === true) {
|
|
71
|
-
const detected = detectKnownAgentEnvironment();
|
|
72
|
-
if (detected)
|
|
73
|
-
return detected;
|
|
74
|
-
}
|
|
75
|
-
return 'CLI';
|
|
76
|
-
}
|
|
77
|
-
function resolveCompression(context) {
|
|
78
|
-
if (context?.settings?.['interlace/compression'] !== undefined) {
|
|
79
|
-
return context.settings['interlace/compression'];
|
|
80
|
-
}
|
|
81
|
-
return GLOBAL_AI_CONFIG.compression;
|
|
82
|
-
}
|
|
83
|
-
function setAIMessagingMode(mode) {
|
|
84
|
-
GLOBAL_AI_CONFIG.mode = mode;
|
|
85
|
-
}
|
|
86
|
-
function getAIMessagingMode() {
|
|
87
|
-
return GLOBAL_AI_CONFIG.mode;
|
|
88
|
-
}
|
|
89
|
-
function setTokenCompression(enabled) {
|
|
90
|
-
GLOBAL_AI_CONFIG.compression = enabled;
|
|
91
|
-
}
|
|
92
|
-
function isTokenCompressionEnabled() {
|
|
93
|
-
return GLOBAL_AI_CONFIG.compression;
|
|
94
|
-
}
|
|
95
|
-
function resetGlobalAIConfig() {
|
|
96
|
-
GLOBAL_AI_CONFIG.mode = 'CLI';
|
|
97
|
-
GLOBAL_AI_CONFIG.compression = false;
|
|
98
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.KNOWN_AGENT_ENVIRONMENTS=void 0;exports.detectKnownAgentEnvironment=detectKnownAgentEnvironment;exports.resolveAIMode=resolveAIMode;exports.resolveCompression=resolveCompression;exports.setAIMessagingMode=setAIMessagingMode;exports.getAIMessagingMode=getAIMessagingMode;exports.setTokenCompression=setTokenCompression;exports.isTokenCompressionEnabled=isTokenCompressionEnabled;exports.resetGlobalAIConfig=resetGlobalAIConfig;exports.KNOWN_AGENT_ENVIRONMENTS={CURSOR:{envVar:"CURSOR_AGENT",mode:"IDE_CURSOR",description:"Cursor IDE AI Agent"},GITHUB_COPILOT:{envVar:"GITHUB_COPILOT_WORKSPACE",mode:"AGENT_JSON",description:"GitHub Copilot Workspace"},ANTHROPIC_MCP:{envVar:"ANTHROPIC_MCP",mode:"AGENT_JSON",description:"Anthropic Model Context Protocol"},OPENAI_AGENT:{envVar:"OPENAI_AGENT",mode:"AGENT_JSON",description:"OpenAI Agent / Code Interpreter"},GENERIC_AI:{envVar:"AI_AGENT",mode:"AGENT_JSON",description:"Generic AI Agent (set AI_AGENT=true)"}};const GLOBAL_AI_CONFIG={mode:"CLI",compression:false};function detectKnownAgentEnvironment(){for(const env of Object.values(exports.KNOWN_AGENT_ENVIRONMENTS)){if(process.env[env.envVar]){return env.mode}}return null}function detectEnvironmentFromEnv(){if(process.env["ESLINT_AI_MODE"]){return process.env["ESLINT_AI_MODE"]}const detected=detectKnownAgentEnvironment();if(detected)return detected;if(process.env["CI"])return"CI";return"CLI"}GLOBAL_AI_CONFIG.mode=detectEnvironmentFromEnv();function resolveAIMode(context){if(process.env["ESLINT_AI_MODE"]){return process.env["ESLINT_AI_MODE"]}if(context?.settings?.["interlace/ai-mode"]){return context.settings["interlace/ai-mode"]}if(context?.settings?.["interlace/enableAutoAgentDetection"]===true){const detected=detectKnownAgentEnvironment();if(detected)return detected}return"CLI"}function resolveCompression(context){if(context?.settings?.["interlace/compression"]!==void 0){return context.settings["interlace/compression"]}return GLOBAL_AI_CONFIG.compression}function setAIMessagingMode(mode){GLOBAL_AI_CONFIG.mode=mode}function getAIMessagingMode(){return GLOBAL_AI_CONFIG.mode}function setTokenCompression(enabled){GLOBAL_AI_CONFIG.compression=enabled}function isTokenCompressionEnabled(){return GLOBAL_AI_CONFIG.compression}function resetGlobalAIConfig(){GLOBAL_AI_CONFIG.mode="CLI";GLOBAL_AI_CONFIG.compression=false}
|