@arsh342/athena 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +665 -161
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -12058,13 +12058,13 @@ ${lanes.join("\n")}
|
|
|
12058
12058
|
writeOutputIsTTY() {
|
|
12059
12059
|
return process.stdout.isTTY;
|
|
12060
12060
|
},
|
|
12061
|
-
readFile:
|
|
12061
|
+
readFile: readFile6,
|
|
12062
12062
|
writeFile: writeFile22,
|
|
12063
12063
|
watchFile: watchFile2,
|
|
12064
12064
|
watchDirectory,
|
|
12065
12065
|
preferNonRecursiveWatch: !fsSupportsRecursiveFsWatch,
|
|
12066
12066
|
resolvePath: (path) => _path.resolve(path),
|
|
12067
|
-
fileExists,
|
|
12067
|
+
fileExists: fileExists2,
|
|
12068
12068
|
directoryExists,
|
|
12069
12069
|
getAccessibleFileSystemEntries,
|
|
12070
12070
|
createDirectory(directoryName) {
|
|
@@ -12099,9 +12099,9 @@ ${lanes.join("\n")}
|
|
|
12099
12099
|
return process.memoryUsage().heapUsed;
|
|
12100
12100
|
},
|
|
12101
12101
|
getFileSize(path) {
|
|
12102
|
-
const
|
|
12103
|
-
if (
|
|
12104
|
-
return
|
|
12102
|
+
const stat4 = statSync(path);
|
|
12103
|
+
if (stat4 == null ? void 0 : stat4.isFile()) {
|
|
12104
|
+
return stat4.size;
|
|
12105
12105
|
}
|
|
12106
12106
|
return 0;
|
|
12107
12107
|
},
|
|
@@ -12226,7 +12226,7 @@ ${lanes.join("\n")}
|
|
|
12226
12226
|
if (platform === "win32" || platform === "win64") {
|
|
12227
12227
|
return false;
|
|
12228
12228
|
}
|
|
12229
|
-
return !
|
|
12229
|
+
return !fileExists2(swapCase(__filename));
|
|
12230
12230
|
}
|
|
12231
12231
|
function swapCase(s) {
|
|
12232
12232
|
return s.replace(/\w/g, (ch) => {
|
|
@@ -12264,7 +12264,7 @@ ${lanes.join("\n")}
|
|
|
12264
12264
|
callback
|
|
12265
12265
|
);
|
|
12266
12266
|
}
|
|
12267
|
-
function
|
|
12267
|
+
function readFile6(fileName, _encoding) {
|
|
12268
12268
|
let buffer;
|
|
12269
12269
|
try {
|
|
12270
12270
|
buffer = _fs.readFileSync(fileName);
|
|
@@ -12319,19 +12319,19 @@ ${lanes.join("\n")}
|
|
|
12319
12319
|
if (entry === "." || entry === "..") {
|
|
12320
12320
|
continue;
|
|
12321
12321
|
}
|
|
12322
|
-
let
|
|
12322
|
+
let stat4;
|
|
12323
12323
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
12324
12324
|
const name = combinePaths(path, entry);
|
|
12325
|
-
|
|
12326
|
-
if (!
|
|
12325
|
+
stat4 = statSync(name);
|
|
12326
|
+
if (!stat4) {
|
|
12327
12327
|
continue;
|
|
12328
12328
|
}
|
|
12329
12329
|
} else {
|
|
12330
|
-
|
|
12330
|
+
stat4 = dirent;
|
|
12331
12331
|
}
|
|
12332
|
-
if (
|
|
12332
|
+
if (stat4.isFile()) {
|
|
12333
12333
|
files.push(entry);
|
|
12334
|
-
} else if (
|
|
12334
|
+
} else if (stat4.isDirectory()) {
|
|
12335
12335
|
directories.push(entry);
|
|
12336
12336
|
}
|
|
12337
12337
|
}
|
|
@@ -12346,20 +12346,20 @@ ${lanes.join("\n")}
|
|
|
12346
12346
|
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
12347
12347
|
}
|
|
12348
12348
|
function fileSystemEntryExists(path, entryKind) {
|
|
12349
|
-
const
|
|
12350
|
-
if (!
|
|
12349
|
+
const stat4 = statSync(path);
|
|
12350
|
+
if (!stat4) {
|
|
12351
12351
|
return false;
|
|
12352
12352
|
}
|
|
12353
12353
|
switch (entryKind) {
|
|
12354
12354
|
case 0:
|
|
12355
|
-
return
|
|
12355
|
+
return stat4.isFile();
|
|
12356
12356
|
case 1:
|
|
12357
|
-
return
|
|
12357
|
+
return stat4.isDirectory();
|
|
12358
12358
|
default:
|
|
12359
12359
|
return false;
|
|
12360
12360
|
}
|
|
12361
12361
|
}
|
|
12362
|
-
function
|
|
12362
|
+
function fileExists2(path) {
|
|
12363
12363
|
return fileSystemEntryExists(
|
|
12364
12364
|
path,
|
|
12365
12365
|
0
|
|
@@ -48820,7 +48820,7 @@ ${lanes.join("\n")}
|
|
|
48820
48820
|
const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
|
|
48821
48821
|
return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
|
|
48822
48822
|
}
|
|
48823
|
-
function parseCommandLineWorker(diagnostics, commandLine,
|
|
48823
|
+
function parseCommandLineWorker(diagnostics, commandLine, readFile6) {
|
|
48824
48824
|
const options = {};
|
|
48825
48825
|
let watchOptions;
|
|
48826
48826
|
const fileNames = [];
|
|
@@ -48868,7 +48868,7 @@ ${lanes.join("\n")}
|
|
|
48868
48868
|
}
|
|
48869
48869
|
}
|
|
48870
48870
|
function parseResponseFile(fileName) {
|
|
48871
|
-
const text = tryReadFile(fileName,
|
|
48871
|
+
const text = tryReadFile(fileName, readFile6 || ((fileName2) => sys.readFile(fileName2)));
|
|
48872
48872
|
if (!isString(text)) {
|
|
48873
48873
|
errors.push(text);
|
|
48874
48874
|
return;
|
|
@@ -48971,8 +48971,8 @@ ${lanes.join("\n")}
|
|
|
48971
48971
|
unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
|
|
48972
48972
|
optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
|
|
48973
48973
|
};
|
|
48974
|
-
function parseCommandLine(commandLine,
|
|
48975
|
-
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine,
|
|
48974
|
+
function parseCommandLine(commandLine, readFile6) {
|
|
48975
|
+
return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile6);
|
|
48976
48976
|
}
|
|
48977
48977
|
function getOptionFromName(optionName, allowShort) {
|
|
48978
48978
|
return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
|
|
@@ -49054,8 +49054,8 @@ ${lanes.join("\n")}
|
|
|
49054
49054
|
watchOptionsToExtend
|
|
49055
49055
|
);
|
|
49056
49056
|
}
|
|
49057
|
-
function readConfigFile(fileName,
|
|
49058
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
49057
|
+
function readConfigFile(fileName, readFile6) {
|
|
49058
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile6);
|
|
49059
49059
|
return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
|
|
49060
49060
|
}
|
|
49061
49061
|
function parseConfigFileTextToJson(fileName, jsonText) {
|
|
@@ -49070,14 +49070,14 @@ ${lanes.join("\n")}
|
|
|
49070
49070
|
error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
|
|
49071
49071
|
};
|
|
49072
49072
|
}
|
|
49073
|
-
function readJsonConfigFile(fileName,
|
|
49074
|
-
const textOrDiagnostic = tryReadFile(fileName,
|
|
49073
|
+
function readJsonConfigFile(fileName, readFile6) {
|
|
49074
|
+
const textOrDiagnostic = tryReadFile(fileName, readFile6);
|
|
49075
49075
|
return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
|
|
49076
49076
|
}
|
|
49077
|
-
function tryReadFile(fileName,
|
|
49077
|
+
function tryReadFile(fileName, readFile6) {
|
|
49078
49078
|
let text;
|
|
49079
49079
|
try {
|
|
49080
|
-
text =
|
|
49080
|
+
text = readFile6(fileName);
|
|
49081
49081
|
} catch (e) {
|
|
49082
49082
|
return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
|
|
49083
49083
|
}
|
|
@@ -127174,7 +127174,7 @@ ${lanes.join("\n")}
|
|
|
127174
127174
|
}
|
|
127175
127175
|
}
|
|
127176
127176
|
function createImportCallExpressionAMD(arg, containsLexicalThis) {
|
|
127177
|
-
const
|
|
127177
|
+
const resolve10 = factory2.createUniqueName("resolve");
|
|
127178
127178
|
const reject = factory2.createUniqueName("reject");
|
|
127179
127179
|
const parameters = [
|
|
127180
127180
|
factory2.createParameterDeclaration(
|
|
@@ -127183,7 +127183,7 @@ ${lanes.join("\n")}
|
|
|
127183
127183
|
/*dotDotDotToken*/
|
|
127184
127184
|
void 0,
|
|
127185
127185
|
/*name*/
|
|
127186
|
-
|
|
127186
|
+
resolve10
|
|
127187
127187
|
),
|
|
127188
127188
|
factory2.createParameterDeclaration(
|
|
127189
127189
|
/*modifiers*/
|
|
@@ -127200,7 +127200,7 @@ ${lanes.join("\n")}
|
|
|
127200
127200
|
factory2.createIdentifier("require"),
|
|
127201
127201
|
/*typeArguments*/
|
|
127202
127202
|
void 0,
|
|
127203
|
-
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]),
|
|
127203
|
+
[factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve10, reject]
|
|
127204
127204
|
)
|
|
127205
127205
|
)
|
|
127206
127206
|
]);
|
|
@@ -138185,7 +138185,7 @@ ${lanes.join("\n")}
|
|
|
138185
138185
|
const getCanonicalFileName = createGetCanonicalFileName(useCaseSensitiveFileNames2);
|
|
138186
138186
|
return {
|
|
138187
138187
|
useCaseSensitiveFileNames: useCaseSensitiveFileNames2,
|
|
138188
|
-
fileExists,
|
|
138188
|
+
fileExists: fileExists2,
|
|
138189
138189
|
readFile: (path, encoding) => host.readFile(path, encoding),
|
|
138190
138190
|
directoryExists: host.directoryExists && directoryExists,
|
|
138191
138191
|
getDirectories,
|
|
@@ -138271,7 +138271,7 @@ ${lanes.join("\n")}
|
|
|
138271
138271
|
}
|
|
138272
138272
|
return host.writeFile(fileName, data, writeByteOrderMark);
|
|
138273
138273
|
}
|
|
138274
|
-
function
|
|
138274
|
+
function fileExists2(fileName) {
|
|
138275
138275
|
const path = toPath3(fileName);
|
|
138276
138276
|
const result = getCachedFileSystemEntriesForBaseDir(path);
|
|
138277
138277
|
return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName);
|
|
@@ -138387,10 +138387,10 @@ ${lanes.join("\n")}
|
|
|
138387
138387
|
clearFirstAncestorEntry(filePath);
|
|
138388
138388
|
}
|
|
138389
138389
|
}
|
|
138390
|
-
function updateFilesOfFileSystemEntry(parentResult, baseName,
|
|
138390
|
+
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists22) {
|
|
138391
138391
|
const canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles;
|
|
138392
138392
|
const canonicalizedBaseName = getCanonicalFileName(baseName);
|
|
138393
|
-
if (
|
|
138393
|
+
if (fileExists22) {
|
|
138394
138394
|
if (insertSorted(canonicalizedFiles, canonicalizedBaseName, compareStringsCaseSensitive)) {
|
|
138395
138395
|
parentResult.files.push(baseName);
|
|
138396
138396
|
}
|
|
@@ -138690,10 +138690,10 @@ ${lanes.join("\n")}
|
|
|
138690
138690
|
function closeFileWatcherOf(objWithWatcher) {
|
|
138691
138691
|
objWithWatcher.watcher.close();
|
|
138692
138692
|
}
|
|
138693
|
-
function findConfigFile(searchPath,
|
|
138693
|
+
function findConfigFile(searchPath, fileExists2, configName = "tsconfig.json") {
|
|
138694
138694
|
return forEachAncestorDirectory(searchPath, (ancestor) => {
|
|
138695
138695
|
const fileName = combinePaths(ancestor, configName);
|
|
138696
|
-
return
|
|
138696
|
+
return fileExists2(fileName) ? fileName : void 0;
|
|
138697
138697
|
});
|
|
138698
138698
|
}
|
|
138699
138699
|
function resolveTripleslashReference(moduleName, containingFile) {
|
|
@@ -138735,12 +138735,12 @@ ${lanes.join("\n")}
|
|
|
138735
138735
|
function createCompilerHost(options, setParentNodes) {
|
|
138736
138736
|
return createCompilerHostWorker(options, setParentNodes);
|
|
138737
138737
|
}
|
|
138738
|
-
function createGetSourceFile(
|
|
138738
|
+
function createGetSourceFile(readFile6, setParentNodes) {
|
|
138739
138739
|
return (fileName, languageVersionOrOptions, onError) => {
|
|
138740
138740
|
let text;
|
|
138741
138741
|
try {
|
|
138742
138742
|
mark("beforeIORead");
|
|
138743
|
-
text =
|
|
138743
|
+
text = readFile6(fileName);
|
|
138744
138744
|
mark("afterIORead");
|
|
138745
138745
|
measure("I/O Read", "beforeIORead", "afterIORead");
|
|
138746
138746
|
} catch (e) {
|
|
@@ -139300,14 +139300,14 @@ ${lanes.join("\n")}
|
|
|
139300
139300
|
}
|
|
139301
139301
|
return { file, pos, end, packageId };
|
|
139302
139302
|
}
|
|
139303
|
-
function isProgramUptoDate(program3, rootFileNames, newOptions, getSourceVersion,
|
|
139303
|
+
function isProgramUptoDate(program3, rootFileNames, newOptions, getSourceVersion, fileExists2, hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
139304
139304
|
if (!program3 || (hasChangedAutomaticTypeDirectiveNames == null ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false;
|
|
139305
139305
|
if (!arrayIsEqualTo(program3.getRootFileNames(), rootFileNames)) return false;
|
|
139306
139306
|
let seenResolvedRefs;
|
|
139307
139307
|
if (!arrayIsEqualTo(program3.getProjectReferences(), projectReferences, projectReferenceUptoDate)) return false;
|
|
139308
139308
|
if (program3.getSourceFiles().some(sourceFileNotUptoDate)) return false;
|
|
139309
139309
|
const missingPaths = program3.getMissingFilePaths();
|
|
139310
|
-
if (missingPaths && forEachEntry(missingPaths,
|
|
139310
|
+
if (missingPaths && forEachEntry(missingPaths, fileExists2)) return false;
|
|
139311
139311
|
const currentOptions = program3.getCompilerOptions();
|
|
139312
139312
|
if (!compareDataObjects(currentOptions, newOptions)) return false;
|
|
139313
139313
|
if (program3.resolvedLibReferences && forEachEntry(program3.resolvedLibReferences, (_value, libFileName) => hasInvalidatedLibResolutions(libFileName))) return false;
|
|
@@ -139635,7 +139635,7 @@ ${lanes.join("\n")}
|
|
|
139635
139635
|
let mapSourceFileToResolvedRef;
|
|
139636
139636
|
let mapOutputFileToResolvedRef;
|
|
139637
139637
|
const useSourceOfProjectReferenceRedirect = !!((_d = host.useSourceOfProjectReferenceRedirect) == null ? void 0 : _d.call(host)) && !options.disableSourceOfProjectReferenceRedirect;
|
|
139638
|
-
const { onProgramCreateComplete, fileExists, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
139638
|
+
const { onProgramCreateComplete, fileExists: fileExists2, directoryExists } = updateHostForUseSourceOfProjectReferenceRedirect({
|
|
139639
139639
|
compilerHost: host,
|
|
139640
139640
|
getSymlinkCache,
|
|
139641
139641
|
useSourceOfProjectReferenceRedirect,
|
|
@@ -139644,7 +139644,7 @@ ${lanes.join("\n")}
|
|
|
139644
139644
|
getRedirectFromOutput,
|
|
139645
139645
|
forEachResolvedProjectReference: forEachResolvedProjectReference2
|
|
139646
139646
|
});
|
|
139647
|
-
const
|
|
139647
|
+
const readFile6 = host.readFile.bind(host);
|
|
139648
139648
|
(_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
|
|
139649
139649
|
const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
|
|
139650
139650
|
(_f = tracing) == null ? void 0 : _f.pop();
|
|
@@ -139869,8 +139869,8 @@ ${lanes.join("\n")}
|
|
|
139869
139869
|
getImpliedNodeFormatForEmit: getImpliedNodeFormatForEmit2,
|
|
139870
139870
|
shouldTransformImportCall,
|
|
139871
139871
|
emitBuildInfo,
|
|
139872
|
-
fileExists,
|
|
139873
|
-
readFile:
|
|
139872
|
+
fileExists: fileExists2,
|
|
139873
|
+
readFile: readFile6,
|
|
139874
139874
|
directoryExists,
|
|
139875
139875
|
getSymlinkCache,
|
|
139876
139876
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
|
@@ -140683,10 +140683,10 @@ ${lanes.join("\n")}
|
|
|
140683
140683
|
function getJSSyntacticDiagnosticsForFile(sourceFile) {
|
|
140684
140684
|
return runWithCancellationToken(() => {
|
|
140685
140685
|
const diagnostics = [];
|
|
140686
|
-
|
|
140687
|
-
forEachChildRecursively(sourceFile,
|
|
140686
|
+
walk3(sourceFile, sourceFile);
|
|
140687
|
+
forEachChildRecursively(sourceFile, walk3, walkArray);
|
|
140688
140688
|
return diagnostics;
|
|
140689
|
-
function
|
|
140689
|
+
function walk3(node, parent2) {
|
|
140690
140690
|
switch (parent2.kind) {
|
|
140691
140691
|
case 170:
|
|
140692
140692
|
case 173:
|
|
@@ -142368,8 +142368,8 @@ ${lanes.join("\n")}
|
|
|
142368
142368
|
const originalDirectoryExists = host.compilerHost.directoryExists;
|
|
142369
142369
|
const originalGetDirectories = host.compilerHost.getDirectories;
|
|
142370
142370
|
const originalRealpath = host.compilerHost.realpath;
|
|
142371
|
-
if (!host.useSourceOfProjectReferenceRedirect) return { onProgramCreateComplete: noop, fileExists };
|
|
142372
|
-
host.compilerHost.fileExists =
|
|
142371
|
+
if (!host.useSourceOfProjectReferenceRedirect) return { onProgramCreateComplete: noop, fileExists: fileExists2 };
|
|
142372
|
+
host.compilerHost.fileExists = fileExists2;
|
|
142373
142373
|
let directoryExists;
|
|
142374
142374
|
if (originalDirectoryExists) {
|
|
142375
142375
|
directoryExists = host.compilerHost.directoryExists = (path) => {
|
|
@@ -142408,13 +142408,13 @@ ${lanes.join("\n")}
|
|
|
142408
142408
|
return ((_a = host.getSymlinkCache().getSymlinkedFiles()) == null ? void 0 : _a.get(host.toPath(s))) || originalRealpath.call(host.compilerHost, s);
|
|
142409
142409
|
};
|
|
142410
142410
|
}
|
|
142411
|
-
return { onProgramCreateComplete, fileExists, directoryExists };
|
|
142411
|
+
return { onProgramCreateComplete, fileExists: fileExists2, directoryExists };
|
|
142412
142412
|
function onProgramCreateComplete() {
|
|
142413
142413
|
host.compilerHost.fileExists = originalFileExists;
|
|
142414
142414
|
host.compilerHost.directoryExists = originalDirectoryExists;
|
|
142415
142415
|
host.compilerHost.getDirectories = originalGetDirectories;
|
|
142416
142416
|
}
|
|
142417
|
-
function
|
|
142417
|
+
function fileExists2(file) {
|
|
142418
142418
|
if (originalFileExists.call(host.compilerHost, file)) return true;
|
|
142419
142419
|
if (!host.getResolvedProjectReferences()) return false;
|
|
142420
142420
|
if (!isDeclarationFileName(file)) return false;
|
|
@@ -146766,7 +146766,7 @@ ${lanes.join("\n")}
|
|
|
146766
146766
|
compilerHost.getSourceFile = (fileName, ...args) => getVersionedSourceFileByPath(fileName, toPath3(fileName), ...args);
|
|
146767
146767
|
compilerHost.getSourceFileByPath = getVersionedSourceFileByPath;
|
|
146768
146768
|
compilerHost.getNewLine = () => newLine;
|
|
146769
|
-
compilerHost.fileExists =
|
|
146769
|
+
compilerHost.fileExists = fileExists2;
|
|
146770
146770
|
compilerHost.onReleaseOldSourceFile = onReleaseOldSourceFile;
|
|
146771
146771
|
compilerHost.onReleaseParsedCommandLine = onReleaseParsedCommandLine;
|
|
146772
146772
|
compilerHost.toPath = toPath3;
|
|
@@ -146970,7 +146970,7 @@ ${lanes.join("\n")}
|
|
|
146970
146970
|
function isFilePresenceUnknownOnHost(hostSourceFile) {
|
|
146971
146971
|
return typeof hostSourceFile.version === "boolean";
|
|
146972
146972
|
}
|
|
146973
|
-
function
|
|
146973
|
+
function fileExists2(fileName) {
|
|
146974
146974
|
const path = toPath3(fileName);
|
|
146975
146975
|
if (isFileMissingOnHost(sourceFilesCache.get(path))) {
|
|
146976
146976
|
return false;
|
|
@@ -153939,15 +153939,15 @@ ${lanes.join("\n")}
|
|
|
153939
153939
|
}
|
|
153940
153940
|
return true;
|
|
153941
153941
|
}
|
|
153942
|
-
function getMappedLocation(location, sourceMapper,
|
|
153942
|
+
function getMappedLocation(location, sourceMapper, fileExists2) {
|
|
153943
153943
|
const mapsTo = sourceMapper.tryGetSourcePosition(location);
|
|
153944
|
-
return mapsTo && (!
|
|
153944
|
+
return mapsTo && (!fileExists2 || fileExists2(normalizePath(mapsTo.fileName)) ? mapsTo : void 0);
|
|
153945
153945
|
}
|
|
153946
|
-
function getMappedDocumentSpan(documentSpan, sourceMapper,
|
|
153946
|
+
function getMappedDocumentSpan(documentSpan, sourceMapper, fileExists2) {
|
|
153947
153947
|
const { fileName, textSpan } = documentSpan;
|
|
153948
|
-
const newPosition = getMappedLocation({ fileName, pos: textSpan.start }, sourceMapper,
|
|
153948
|
+
const newPosition = getMappedLocation({ fileName, pos: textSpan.start }, sourceMapper, fileExists2);
|
|
153949
153949
|
if (!newPosition) return void 0;
|
|
153950
|
-
const newEndPosition = getMappedLocation({ fileName, pos: textSpan.start + textSpan.length }, sourceMapper,
|
|
153950
|
+
const newEndPosition = getMappedLocation({ fileName, pos: textSpan.start + textSpan.length }, sourceMapper, fileExists2);
|
|
153951
153951
|
const newLength = newEndPosition ? newEndPosition.pos - newPosition.pos : textSpan.length;
|
|
153952
153952
|
return {
|
|
153953
153953
|
fileName: newPosition.fileName,
|
|
@@ -153957,20 +153957,20 @@ ${lanes.join("\n")}
|
|
|
153957
153957
|
},
|
|
153958
153958
|
originalFileName: documentSpan.fileName,
|
|
153959
153959
|
originalTextSpan: documentSpan.textSpan,
|
|
153960
|
-
contextSpan: getMappedContextSpan(documentSpan, sourceMapper,
|
|
153960
|
+
contextSpan: getMappedContextSpan(documentSpan, sourceMapper, fileExists2),
|
|
153961
153961
|
originalContextSpan: documentSpan.contextSpan
|
|
153962
153962
|
};
|
|
153963
153963
|
}
|
|
153964
|
-
function getMappedContextSpan(documentSpan, sourceMapper,
|
|
153964
|
+
function getMappedContextSpan(documentSpan, sourceMapper, fileExists2) {
|
|
153965
153965
|
const contextSpanStart = documentSpan.contextSpan && getMappedLocation(
|
|
153966
153966
|
{ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start },
|
|
153967
153967
|
sourceMapper,
|
|
153968
|
-
|
|
153968
|
+
fileExists2
|
|
153969
153969
|
);
|
|
153970
153970
|
const contextSpanEnd = documentSpan.contextSpan && getMappedLocation(
|
|
153971
153971
|
{ fileName: documentSpan.fileName, pos: documentSpan.contextSpan.start + documentSpan.contextSpan.length },
|
|
153972
153972
|
sourceMapper,
|
|
153973
|
-
|
|
153973
|
+
fileExists2
|
|
153974
153974
|
);
|
|
153975
153975
|
return contextSpanStart && contextSpanEnd ? { start: contextSpanStart.pos, length: contextSpanEnd.pos - contextSpanStart.pos } : void 0;
|
|
153976
153976
|
}
|
|
@@ -167632,7 +167632,7 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
167632
167632
|
}
|
|
167633
167633
|
function initializeNameTable(sourceFile) {
|
|
167634
167634
|
const nameTable = sourceFile.nameTable = /* @__PURE__ */ new Map();
|
|
167635
|
-
sourceFile.forEachChild(function
|
|
167635
|
+
sourceFile.forEachChild(function walk3(node) {
|
|
167636
167636
|
if (isIdentifier(node) && !isTagName(node) && node.escapedText || isStringOrNumericLiteralLike(node) && literalIsName(node)) {
|
|
167637
167637
|
const text = getEscapedTextOfIdentifierOrLiteral(node);
|
|
167638
167638
|
nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1);
|
|
@@ -167640,10 +167640,10 @@ ${newComment.split("\n").map((c3) => ` * ${c3}`).join("\n")}
|
|
|
167640
167640
|
const text = node.escapedText;
|
|
167641
167641
|
nameTable.set(text, nameTable.get(text) === void 0 ? node.pos : -1);
|
|
167642
167642
|
}
|
|
167643
|
-
forEachChild(node,
|
|
167643
|
+
forEachChild(node, walk3);
|
|
167644
167644
|
if (hasJSDocNodes(node)) {
|
|
167645
167645
|
for (const jsDoc of node.jsDoc) {
|
|
167646
|
-
forEachChild(jsDoc,
|
|
167646
|
+
forEachChild(jsDoc, walk3);
|
|
167647
167647
|
}
|
|
167648
167648
|
}
|
|
167649
167649
|
});
|
|
@@ -202454,9 +202454,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
202454
202454
|
this.markContainingProjectsAsDirty();
|
|
202455
202455
|
}
|
|
202456
202456
|
}
|
|
202457
|
-
close(
|
|
202457
|
+
close(fileExists2 = true) {
|
|
202458
202458
|
this.textStorage.isOpen = false;
|
|
202459
|
-
if (
|
|
202459
|
+
if (fileExists2 && this.textStorage.scheduleReloadIfNeeded()) {
|
|
202460
202460
|
this.markContainingProjectsAsDirty();
|
|
202461
202461
|
}
|
|
202462
202462
|
}
|
|
@@ -203560,11 +203560,11 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
203560
203560
|
this.rootFilesMap.set(path, { fileName });
|
|
203561
203561
|
this.markAsDirty();
|
|
203562
203562
|
}
|
|
203563
|
-
removeFile(info,
|
|
203563
|
+
removeFile(info, fileExists2, detachFromProject) {
|
|
203564
203564
|
if (this.isRoot(info)) {
|
|
203565
203565
|
this.removeRoot(info);
|
|
203566
203566
|
}
|
|
203567
|
-
if (
|
|
203567
|
+
if (fileExists2) {
|
|
203568
203568
|
this.resolutionCache.removeResolutionsOfFile(info.path);
|
|
203569
203569
|
} else {
|
|
203570
203570
|
this.resolutionCache.invalidateResolutionOfFile(info.path);
|
|
@@ -206434,8 +206434,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
206434
206434
|
*/
|
|
206435
206435
|
closeOpenFile(info, skipAssignOrphanScriptInfosToInferredProject) {
|
|
206436
206436
|
var _a;
|
|
206437
|
-
const
|
|
206438
|
-
info.close(
|
|
206437
|
+
const fileExists2 = info.isDynamic ? false : this.host.fileExists(info.fileName);
|
|
206438
|
+
info.close(fileExists2);
|
|
206439
206439
|
this.stopWatchingConfigFilesForScriptInfo(info);
|
|
206440
206440
|
const canonicalFileName = this.toCanonicalFileName(info.fileName);
|
|
206441
206441
|
if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) {
|
|
@@ -206461,7 +206461,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
206461
206461
|
}
|
|
206462
206462
|
p.removeFile(
|
|
206463
206463
|
info,
|
|
206464
|
-
|
|
206464
|
+
fileExists2,
|
|
206465
206465
|
/*detachFromProject*/
|
|
206466
206466
|
true
|
|
206467
206467
|
);
|
|
@@ -206477,7 +206477,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
206477
206477
|
if (!skipAssignOrphanScriptInfosToInferredProject && ensureProjectsForOpenFiles) {
|
|
206478
206478
|
this.assignOrphanScriptInfosToInferredProject();
|
|
206479
206479
|
}
|
|
206480
|
-
if (
|
|
206480
|
+
if (fileExists2) {
|
|
206481
206481
|
this.watchClosedScriptInfo(info);
|
|
206482
206482
|
} else {
|
|
206483
206483
|
this.handleDeletedFile(
|
|
@@ -213918,8 +213918,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
|
|
|
213918
213918
|
installPackage(options) {
|
|
213919
213919
|
this.packageInstallId++;
|
|
213920
213920
|
const request = { kind: "installPackage", ...options, id: this.packageInstallId };
|
|
213921
|
-
const promise = new Promise((
|
|
213922
|
-
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve:
|
|
213921
|
+
const promise = new Promise((resolve10, reject) => {
|
|
213922
|
+
(this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve10, reject });
|
|
213923
213923
|
});
|
|
213924
213924
|
this.installer.send(request);
|
|
213925
213925
|
return promise;
|
|
@@ -214264,6 +214264,17 @@ var defaultConfig = {
|
|
|
214264
214264
|
timeoutMs: 6e4,
|
|
214265
214265
|
reportType: "security"
|
|
214266
214266
|
},
|
|
214267
|
+
trivy: {
|
|
214268
|
+
enabled: true,
|
|
214269
|
+
timeoutMs: 12e4,
|
|
214270
|
+
scanners: ["vuln", "misconfig", "secret"],
|
|
214271
|
+
severities: ["HIGH", "CRITICAL"]
|
|
214272
|
+
},
|
|
214273
|
+
horusec: {
|
|
214274
|
+
enabled: true,
|
|
214275
|
+
timeoutMs: 18e4,
|
|
214276
|
+
disableDocker: false
|
|
214277
|
+
},
|
|
214267
214278
|
maxFileSize: 1048576,
|
|
214268
214279
|
weights: defaultWeights
|
|
214269
214280
|
};
|
|
@@ -214297,6 +214308,17 @@ function mergeConfig(config = {}) {
|
|
|
214297
214308
|
timeoutMs: config.bearer?.timeoutMs ?? defaultConfig.bearer.timeoutMs,
|
|
214298
214309
|
reportType: config.bearer?.reportType ?? defaultConfig.bearer.reportType
|
|
214299
214310
|
},
|
|
214311
|
+
trivy: {
|
|
214312
|
+
enabled: config.trivy?.enabled ?? defaultConfig.trivy.enabled,
|
|
214313
|
+
timeoutMs: config.trivy?.timeoutMs ?? defaultConfig.trivy.timeoutMs,
|
|
214314
|
+
scanners: config.trivy?.scanners ?? defaultConfig.trivy.scanners,
|
|
214315
|
+
severities: config.trivy?.severities ?? defaultConfig.trivy.severities
|
|
214316
|
+
},
|
|
214317
|
+
horusec: {
|
|
214318
|
+
enabled: config.horusec?.enabled ?? defaultConfig.horusec.enabled,
|
|
214319
|
+
timeoutMs: config.horusec?.timeoutMs ?? defaultConfig.horusec.timeoutMs,
|
|
214320
|
+
disableDocker: config.horusec?.disableDocker ?? defaultConfig.horusec.disableDocker
|
|
214321
|
+
},
|
|
214300
214322
|
weights: {
|
|
214301
214323
|
...defaultWeights,
|
|
214302
214324
|
...config.weights
|
|
@@ -214305,7 +214327,7 @@ function mergeConfig(config = {}) {
|
|
|
214305
214327
|
}
|
|
214306
214328
|
|
|
214307
214329
|
// ../core/dist/engine.js
|
|
214308
|
-
var
|
|
214330
|
+
var import_promises4 = require("fs/promises");
|
|
214309
214331
|
|
|
214310
214332
|
// ../core/dist/analyzers/hallucination-detector.js
|
|
214311
214333
|
var import_node_crypto = require("crypto");
|
|
@@ -215633,6 +215655,366 @@ function getBearerCategory(category, dataTypes) {
|
|
|
215633
215655
|
return lowerCategory.replace(/\s+/g, "-");
|
|
215634
215656
|
}
|
|
215635
215657
|
|
|
215658
|
+
// ../core/dist/analyzers/trivy-adapter.js
|
|
215659
|
+
var import_node_crypto9 = require("crypto");
|
|
215660
|
+
var import_node_child_process6 = require("child_process");
|
|
215661
|
+
var import_node_util6 = require("util");
|
|
215662
|
+
var import_node_path6 = require("path");
|
|
215663
|
+
var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process6.execFile);
|
|
215664
|
+
async function runTrivy(projectRoot, config) {
|
|
215665
|
+
if (!config.enabled)
|
|
215666
|
+
return [];
|
|
215667
|
+
const scanners = (config.scanners?.length ? config.scanners : ["vuln", "misconfig", "secret"]).join(",");
|
|
215668
|
+
const severities = (config.severities?.length ? config.severities : ["HIGH", "CRITICAL"]).join(",");
|
|
215669
|
+
try {
|
|
215670
|
+
const output = await execTrivy([
|
|
215671
|
+
"fs",
|
|
215672
|
+
"--format",
|
|
215673
|
+
"json",
|
|
215674
|
+
"--quiet",
|
|
215675
|
+
"--scanners",
|
|
215676
|
+
scanners,
|
|
215677
|
+
"--severity",
|
|
215678
|
+
severities,
|
|
215679
|
+
projectRoot
|
|
215680
|
+
], config.timeoutMs);
|
|
215681
|
+
if (!output)
|
|
215682
|
+
return [];
|
|
215683
|
+
return normalizeTrivyReport(safeParseTrivy(output), projectRoot);
|
|
215684
|
+
} catch (error) {
|
|
215685
|
+
const withStreams = error;
|
|
215686
|
+
if (withStreams?.code === "ENOENT") {
|
|
215687
|
+
console.warn("[athena-core] Trivy not installed; skipping Trivy scan. Install from https://trivy.dev/latest/getting-started/installation/");
|
|
215688
|
+
return [];
|
|
215689
|
+
}
|
|
215690
|
+
const detail = withStreams?.stderr?.trim() || withStreams?.message || String(error);
|
|
215691
|
+
console.warn(`[athena-core] Trivy execution failed: ${detail}`);
|
|
215692
|
+
return [];
|
|
215693
|
+
}
|
|
215694
|
+
}
|
|
215695
|
+
async function execTrivy(args, timeoutMs) {
|
|
215696
|
+
try {
|
|
215697
|
+
const { stdout } = await execFileAsync6("trivy", args, {
|
|
215698
|
+
timeout: timeoutMs,
|
|
215699
|
+
maxBuffer: 20 * 1024 * 1024
|
|
215700
|
+
});
|
|
215701
|
+
return stdout;
|
|
215702
|
+
} catch (error) {
|
|
215703
|
+
const withStreams = error;
|
|
215704
|
+
if (withStreams?.stdout && withStreams.stdout.trim().startsWith("{")) {
|
|
215705
|
+
return withStreams.stdout;
|
|
215706
|
+
}
|
|
215707
|
+
if (withStreams?.code === "ENOENT") {
|
|
215708
|
+
console.warn("[athena-core] Trivy not installed; skipping Trivy scan");
|
|
215709
|
+
return null;
|
|
215710
|
+
}
|
|
215711
|
+
const detail = withStreams?.stderr?.trim() || withStreams?.message || String(error);
|
|
215712
|
+
console.warn(`[athena-core] Trivy execution failed: ${detail}`);
|
|
215713
|
+
return null;
|
|
215714
|
+
}
|
|
215715
|
+
}
|
|
215716
|
+
function safeParseTrivy(json) {
|
|
215717
|
+
try {
|
|
215718
|
+
return JSON.parse(json);
|
|
215719
|
+
} catch {
|
|
215720
|
+
return { Results: [] };
|
|
215721
|
+
}
|
|
215722
|
+
}
|
|
215723
|
+
function normalizeTrivyReport(report, projectRoot) {
|
|
215724
|
+
return (report.Results ?? []).flatMap((result) => {
|
|
215725
|
+
const file = resolveTrivyTarget(projectRoot, result.Target);
|
|
215726
|
+
return [
|
|
215727
|
+
...(result.Vulnerabilities ?? []).map((finding) => normalizeTrivyVulnerability(finding, file)),
|
|
215728
|
+
...(result.Misconfigurations ?? []).map((finding) => normalizeTrivyMisconfiguration(finding, file)),
|
|
215729
|
+
...(result.Secrets ?? []).map((finding) => normalizeTrivySecret(finding, file))
|
|
215730
|
+
];
|
|
215731
|
+
});
|
|
215732
|
+
}
|
|
215733
|
+
function resolveTrivyTarget(projectRoot, target) {
|
|
215734
|
+
if (!target || target.trim().length === 0)
|
|
215735
|
+
return (0, import_node_path6.resolve)(projectRoot, "package.json");
|
|
215736
|
+
return (0, import_node_path6.resolve)(projectRoot, target);
|
|
215737
|
+
}
|
|
215738
|
+
function normalizeTrivyVulnerability(finding, file) {
|
|
215739
|
+
const vulnId = finding.VulnerabilityID?.trim() || "trivy-vuln";
|
|
215740
|
+
const pkg = finding.PkgName?.trim() || "dependency";
|
|
215741
|
+
const fixed = finding.FixedVersion?.trim() ? `; fixed=${finding.FixedVersion.trim()}` : "";
|
|
215742
|
+
const installed = finding.InstalledVersion?.trim() ? ` installed=${finding.InstalledVersion.trim()}` : "";
|
|
215743
|
+
const title = finding.Title?.trim() || finding.Description?.trim() || `Vulnerability in ${pkg}`;
|
|
215744
|
+
return {
|
|
215745
|
+
id: (0, import_node_crypto9.createHash)("sha1").update(`trivy:vuln:${file}:${vulnId}:${pkg}`).digest("hex").slice(0, 10),
|
|
215746
|
+
ruleId: `trivy:${vulnId}`,
|
|
215747
|
+
file,
|
|
215748
|
+
line: 1,
|
|
215749
|
+
column: 1,
|
|
215750
|
+
code: `${pkg}${installed}`.trim(),
|
|
215751
|
+
type: "Trivy Vulnerability",
|
|
215752
|
+
message: `${title} (${pkg}${fixed})`,
|
|
215753
|
+
category: "supply-chain-security",
|
|
215754
|
+
severity: mapTrivySeverity(finding.Severity)
|
|
215755
|
+
};
|
|
215756
|
+
}
|
|
215757
|
+
function normalizeTrivyMisconfiguration(finding, file) {
|
|
215758
|
+
const ruleId = finding.ID?.trim() || finding.AVDID?.trim() || "trivy-misconfig";
|
|
215759
|
+
const line = finding.CauseMetadata?.StartLine || 1;
|
|
215760
|
+
const code = finding.CauseMetadata?.Code?.Lines?.map((entry) => entry.Content?.trim() || "").filter(Boolean).join("\n") || "";
|
|
215761
|
+
const title = finding.Title?.trim() || finding.Message?.trim() || finding.Description?.trim() || "Misconfiguration";
|
|
215762
|
+
const resolution = finding.Resolution?.trim() ? ` Resolution: ${finding.Resolution.trim()}` : "";
|
|
215763
|
+
return {
|
|
215764
|
+
id: (0, import_node_crypto9.createHash)("sha1").update(`trivy:misconfig:${file}:${line}:${ruleId}`).digest("hex").slice(0, 10),
|
|
215765
|
+
ruleId: `trivy:${ruleId}`,
|
|
215766
|
+
file,
|
|
215767
|
+
line,
|
|
215768
|
+
column: 1,
|
|
215769
|
+
code,
|
|
215770
|
+
type: "Trivy Misconfiguration",
|
|
215771
|
+
message: `${title}.${resolution}`.trim(),
|
|
215772
|
+
category: "misconfiguration",
|
|
215773
|
+
severity: mapTrivySeverity(finding.Severity)
|
|
215774
|
+
};
|
|
215775
|
+
}
|
|
215776
|
+
function normalizeTrivySecret(finding, file) {
|
|
215777
|
+
const ruleId = finding.RuleID?.trim() || "trivy-secret";
|
|
215778
|
+
const line = finding.StartLine || 1;
|
|
215779
|
+
const title = finding.Title?.trim() || finding.Category?.trim() || "Hardcoded secret";
|
|
215780
|
+
return {
|
|
215781
|
+
id: (0, import_node_crypto9.createHash)("sha1").update(`trivy:secret:${file}:${line}:${ruleId}`).digest("hex").slice(0, 10),
|
|
215782
|
+
ruleId: `trivy:${ruleId}`,
|
|
215783
|
+
file,
|
|
215784
|
+
line,
|
|
215785
|
+
column: 1,
|
|
215786
|
+
code: finding.Match?.trim() || "",
|
|
215787
|
+
type: "Trivy Secret",
|
|
215788
|
+
message: title,
|
|
215789
|
+
category: "secret-exposure",
|
|
215790
|
+
severity: mapTrivySeverity(finding.Severity)
|
|
215791
|
+
};
|
|
215792
|
+
}
|
|
215793
|
+
function mapTrivySeverity(severity) {
|
|
215794
|
+
const value = (severity || "").toLowerCase();
|
|
215795
|
+
if (value === "critical")
|
|
215796
|
+
return "CRITICAL";
|
|
215797
|
+
if (value === "high")
|
|
215798
|
+
return "HIGH";
|
|
215799
|
+
if (value === "medium")
|
|
215800
|
+
return "MEDIUM";
|
|
215801
|
+
return "LOW";
|
|
215802
|
+
}
|
|
215803
|
+
|
|
215804
|
+
// ../core/dist/analyzers/horusec-adapter.js
|
|
215805
|
+
var import_node_crypto10 = require("crypto");
|
|
215806
|
+
var import_node_child_process7 = require("child_process");
|
|
215807
|
+
var import_promises3 = require("fs/promises");
|
|
215808
|
+
var import_node_os = require("os");
|
|
215809
|
+
var import_node_path7 = require("path");
|
|
215810
|
+
var import_node_util7 = require("util");
|
|
215811
|
+
var execFileAsync7 = (0, import_node_util7.promisify)(import_node_child_process7.execFile);
|
|
215812
|
+
async function runHorusec(projectRoot, config) {
|
|
215813
|
+
if (!config.enabled)
|
|
215814
|
+
return [];
|
|
215815
|
+
const tempDir = await (0, import_promises3.mkdtemp)((0, import_node_path7.join)((0, import_node_os.tmpdir)(), "athena-horusec-"));
|
|
215816
|
+
const reportPath = (0, import_node_path7.join)(tempDir, "horusec-report.json");
|
|
215817
|
+
const shouldDisableDocker = config.disableDocker || !await checkDockerAvailable2();
|
|
215818
|
+
if (shouldDisableDocker) {
|
|
215819
|
+
console.warn("[athena-core] Horusec running with Docker disabled (-D true). Analysis coverage may be reduced.");
|
|
215820
|
+
}
|
|
215821
|
+
try {
|
|
215822
|
+
const output = await execHorusec(projectRoot, reportPath, config.timeoutMs, shouldDisableDocker);
|
|
215823
|
+
const reportText = await readHorusecReport(reportPath, output);
|
|
215824
|
+
if (!reportText)
|
|
215825
|
+
return [];
|
|
215826
|
+
const parsed2 = safeParseHorusec(reportText);
|
|
215827
|
+
return collectHorusecFindings(parsed2, projectRoot);
|
|
215828
|
+
} catch (error) {
|
|
215829
|
+
const withStreams = error;
|
|
215830
|
+
if (withStreams?.code === "ENOENT") {
|
|
215831
|
+
console.warn("[athena-core] Horusec not installed; skipping Horusec scan.");
|
|
215832
|
+
return [];
|
|
215833
|
+
}
|
|
215834
|
+
const detail = withStreams?.stderr?.trim() || withStreams?.message || String(error);
|
|
215835
|
+
console.warn(`[athena-core] Horusec execution failed: ${detail}`);
|
|
215836
|
+
return [];
|
|
215837
|
+
} finally {
|
|
215838
|
+
await (0, import_promises3.rm)(reportPath, { force: true }).catch(() => {
|
|
215839
|
+
});
|
|
215840
|
+
await (0, import_promises3.rm)(tempDir, { recursive: true, force: true }).catch(() => {
|
|
215841
|
+
});
|
|
215842
|
+
await (0, import_promises3.rm)((0, import_node_path7.join)(projectRoot, ".horusec"), { recursive: true, force: true }).catch(() => {
|
|
215843
|
+
});
|
|
215844
|
+
}
|
|
215845
|
+
}
|
|
215846
|
+
async function execHorusec(projectRoot, reportPath, timeoutMs, disableDocker) {
|
|
215847
|
+
const baseArgs = ["start", "-p", projectRoot];
|
|
215848
|
+
if (disableDocker)
|
|
215849
|
+
baseArgs.push("-D", "true");
|
|
215850
|
+
const attempts = [
|
|
215851
|
+
[...baseArgs, "-o", "json", "-O", reportPath],
|
|
215852
|
+
[...baseArgs, "--output-format", "json", "--json-output-file", reportPath]
|
|
215853
|
+
];
|
|
215854
|
+
let lastError = null;
|
|
215855
|
+
for (const args of attempts) {
|
|
215856
|
+
try {
|
|
215857
|
+
const { stdout } = await execFileAsync7("horusec", args, {
|
|
215858
|
+
timeout: timeoutMs,
|
|
215859
|
+
maxBuffer: 20 * 1024 * 1024
|
|
215860
|
+
});
|
|
215861
|
+
return stdout;
|
|
215862
|
+
} catch (error) {
|
|
215863
|
+
lastError = error;
|
|
215864
|
+
const withStreams = error;
|
|
215865
|
+
if (await fileExists(reportPath)) {
|
|
215866
|
+
return withStreams?.stdout || null;
|
|
215867
|
+
}
|
|
215868
|
+
if (withStreams?.code === "ENOENT") {
|
|
215869
|
+
throw error;
|
|
215870
|
+
}
|
|
215871
|
+
}
|
|
215872
|
+
}
|
|
215873
|
+
throw lastError instanceof Error ? lastError : new Error("Horusec execution failed");
|
|
215874
|
+
}
|
|
215875
|
+
async function readHorusecReport(reportPath, stdout) {
|
|
215876
|
+
if (await fileExists(reportPath)) {
|
|
215877
|
+
return (0, import_promises3.readFile)(reportPath, "utf8");
|
|
215878
|
+
}
|
|
215879
|
+
if (stdout && stdout.trim().startsWith("{")) {
|
|
215880
|
+
return stdout;
|
|
215881
|
+
}
|
|
215882
|
+
return null;
|
|
215883
|
+
}
|
|
215884
|
+
async function checkDockerAvailable2() {
|
|
215885
|
+
try {
|
|
215886
|
+
await execFileAsync7("docker", ["--version"], { timeout: 5e3 });
|
|
215887
|
+
return true;
|
|
215888
|
+
} catch {
|
|
215889
|
+
return false;
|
|
215890
|
+
}
|
|
215891
|
+
}
|
|
215892
|
+
async function fileExists(path) {
|
|
215893
|
+
try {
|
|
215894
|
+
await (0, import_promises3.stat)(path);
|
|
215895
|
+
return true;
|
|
215896
|
+
} catch {
|
|
215897
|
+
return false;
|
|
215898
|
+
}
|
|
215899
|
+
}
|
|
215900
|
+
function safeParseHorusec(json) {
|
|
215901
|
+
try {
|
|
215902
|
+
return JSON.parse(json);
|
|
215903
|
+
} catch {
|
|
215904
|
+
return {};
|
|
215905
|
+
}
|
|
215906
|
+
}
|
|
215907
|
+
function collectHorusecFindings(root, projectRoot) {
|
|
215908
|
+
const findings = [];
|
|
215909
|
+
const seen = /* @__PURE__ */ new Set();
|
|
215910
|
+
walk(root, (value) => {
|
|
215911
|
+
const normalized = normalizeHorusecFinding(value, projectRoot);
|
|
215912
|
+
if (!normalized)
|
|
215913
|
+
return;
|
|
215914
|
+
if (seen.has(normalized.id))
|
|
215915
|
+
return;
|
|
215916
|
+
seen.add(normalized.id);
|
|
215917
|
+
findings.push(normalized);
|
|
215918
|
+
});
|
|
215919
|
+
return findings;
|
|
215920
|
+
}
|
|
215921
|
+
function walk(value, onObject) {
|
|
215922
|
+
if (Array.isArray(value)) {
|
|
215923
|
+
for (const entry of value)
|
|
215924
|
+
walk(entry, onObject);
|
|
215925
|
+
return;
|
|
215926
|
+
}
|
|
215927
|
+
if (!value || typeof value !== "object")
|
|
215928
|
+
return;
|
|
215929
|
+
onObject(value);
|
|
215930
|
+
for (const child of Object.values(value))
|
|
215931
|
+
walk(child, onObject);
|
|
215932
|
+
}
|
|
215933
|
+
function normalizeHorusecFinding(value, projectRoot) {
|
|
215934
|
+
const fileRaw = readString(value, ["file", "filename", "path"]);
|
|
215935
|
+
const details = readString(value, ["details", "description", "message"]);
|
|
215936
|
+
const severityRaw = readString(value, ["severity", "risk"]);
|
|
215937
|
+
if (!fileRaw || !details || !severityRaw)
|
|
215938
|
+
return null;
|
|
215939
|
+
const line = readNumber(value, ["line", "lineNumber"]) || 1;
|
|
215940
|
+
const column = readNumber(value, ["column", "col"]) || 1;
|
|
215941
|
+
const code = readString(value, ["code", "content"]) || "";
|
|
215942
|
+
const ruleId = readString(value, ["ruleID", "ruleId", "rule_id"]) || "horusec.unknown-rule";
|
|
215943
|
+
const securityTool = readString(value, ["securityTool", "tool"]) || "Horusec";
|
|
215944
|
+
const typeLabel = readString(value, ["type"]) || "Vulnerability";
|
|
215945
|
+
const category = deriveCategory(ruleId, securityTool, details);
|
|
215946
|
+
const file = (0, import_node_path7.resolve)(projectRoot, normalizeRelativeFile(fileRaw, projectRoot));
|
|
215947
|
+
const severity = mapHorusecSeverity(severityRaw);
|
|
215948
|
+
return {
|
|
215949
|
+
id: (0, import_node_crypto10.createHash)("sha1").update(`horusec:${file}:${line}:${column}:${ruleId}:${details}`).digest("hex").slice(0, 10),
|
|
215950
|
+
ruleId: `horusec:${ruleId}`,
|
|
215951
|
+
file,
|
|
215952
|
+
line,
|
|
215953
|
+
column,
|
|
215954
|
+
code,
|
|
215955
|
+
type: `${securityTool} ${typeLabel}`.trim(),
|
|
215956
|
+
message: details,
|
|
215957
|
+
category,
|
|
215958
|
+
severity
|
|
215959
|
+
};
|
|
215960
|
+
}
|
|
215961
|
+
function normalizeRelativeFile(file, projectRoot) {
|
|
215962
|
+
const normalizedRoot = (0, import_node_path7.resolve)(projectRoot);
|
|
215963
|
+
const normalizedFile = (0, import_node_path7.resolve)(file);
|
|
215964
|
+
if (normalizedFile.startsWith(normalizedRoot))
|
|
215965
|
+
return normalizedFile;
|
|
215966
|
+
return file;
|
|
215967
|
+
}
|
|
215968
|
+
function readString(value, keys) {
|
|
215969
|
+
for (const key of keys) {
|
|
215970
|
+
const candidate = value[key];
|
|
215971
|
+
if (typeof candidate === "string" && candidate.trim().length > 0)
|
|
215972
|
+
return candidate.trim();
|
|
215973
|
+
}
|
|
215974
|
+
return null;
|
|
215975
|
+
}
|
|
215976
|
+
function readNumber(value, keys) {
|
|
215977
|
+
for (const key of keys) {
|
|
215978
|
+
const candidate = value[key];
|
|
215979
|
+
if (typeof candidate === "number" && Number.isFinite(candidate))
|
|
215980
|
+
return candidate;
|
|
215981
|
+
if (typeof candidate === "string") {
|
|
215982
|
+
const parsed2 = Number(candidate);
|
|
215983
|
+
if (Number.isFinite(parsed2))
|
|
215984
|
+
return parsed2;
|
|
215985
|
+
}
|
|
215986
|
+
}
|
|
215987
|
+
return null;
|
|
215988
|
+
}
|
|
215989
|
+
function mapHorusecSeverity(raw) {
|
|
215990
|
+
const value = raw.toUpperCase();
|
|
215991
|
+
if (value.includes("CRITICAL"))
|
|
215992
|
+
return "CRITICAL";
|
|
215993
|
+
if (value.includes("HIGH"))
|
|
215994
|
+
return "HIGH";
|
|
215995
|
+
if (value.includes("MEDIUM"))
|
|
215996
|
+
return "MEDIUM";
|
|
215997
|
+
return "LOW";
|
|
215998
|
+
}
|
|
215999
|
+
function deriveCategory(ruleId, securityTool, details) {
|
|
216000
|
+
const haystack = `${ruleId} ${securityTool} ${details}`.toLowerCase();
|
|
216001
|
+
if (haystack.includes("secret") || haystack.includes("leak"))
|
|
216002
|
+
return "secret-exposure";
|
|
216003
|
+
if (haystack.includes("inject") || haystack.includes("sql"))
|
|
216004
|
+
return "injection";
|
|
216005
|
+
if (haystack.includes("xss") || haystack.includes("cross-site"))
|
|
216006
|
+
return "xss";
|
|
216007
|
+
if (haystack.includes("crypto") || haystack.includes("hash") || haystack.includes("cipher"))
|
|
216008
|
+
return "weak-cryptography";
|
|
216009
|
+
if (haystack.includes("auth") || haystack.includes("token") || haystack.includes("session"))
|
|
216010
|
+
return "authentication";
|
|
216011
|
+
if (haystack.includes("misconfig") || haystack.includes("config"))
|
|
216012
|
+
return "misconfiguration";
|
|
216013
|
+
if (haystack.includes("cve") || haystack.includes("dependency") || haystack.includes("trivy"))
|
|
216014
|
+
return "supply-chain-security";
|
|
216015
|
+
return "code-security";
|
|
216016
|
+
}
|
|
216017
|
+
|
|
215636
216018
|
// ../core/dist/scanner-registry.js
|
|
215637
216019
|
var ScannerRegistry = class {
|
|
215638
216020
|
scanners = /* @__PURE__ */ new Map();
|
|
@@ -215761,10 +216143,10 @@ var ScannerRegistry = class {
|
|
|
215761
216143
|
},
|
|
215762
216144
|
checkAvailable: async () => {
|
|
215763
216145
|
try {
|
|
215764
|
-
const { execFile:
|
|
215765
|
-
const { promisify:
|
|
215766
|
-
const
|
|
215767
|
-
await
|
|
216146
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216147
|
+
const { promisify: promisify11 } = await import("util");
|
|
216148
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216149
|
+
await execFileAsync10("semgrep", ["--version"], { timeout: 5e3 });
|
|
215768
216150
|
return true;
|
|
215769
216151
|
} catch {
|
|
215770
216152
|
return false;
|
|
@@ -215842,10 +216224,10 @@ var ScannerRegistry = class {
|
|
|
215842
216224
|
},
|
|
215843
216225
|
checkAvailable: async () => {
|
|
215844
216226
|
try {
|
|
215845
|
-
const { execFile:
|
|
215846
|
-
const { promisify:
|
|
215847
|
-
const
|
|
215848
|
-
await
|
|
216227
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216228
|
+
const { promisify: promisify11 } = await import("util");
|
|
216229
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216230
|
+
await execFileAsync10("npm", ["--version"], { timeout: 5e3 });
|
|
215849
216231
|
return true;
|
|
215850
216232
|
} catch {
|
|
215851
216233
|
return false;
|
|
@@ -215884,10 +216266,10 @@ var ScannerRegistry = class {
|
|
|
215884
216266
|
},
|
|
215885
216267
|
checkAvailable: async () => {
|
|
215886
216268
|
try {
|
|
215887
|
-
const { execFile:
|
|
215888
|
-
const { promisify:
|
|
215889
|
-
const
|
|
215890
|
-
await
|
|
216269
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216270
|
+
const { promisify: promisify11 } = await import("util");
|
|
216271
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216272
|
+
await execFileAsync10("docker", ["--version"], { timeout: 5e3 });
|
|
215891
216273
|
return true;
|
|
215892
216274
|
} catch {
|
|
215893
216275
|
return false;
|
|
@@ -215926,10 +216308,10 @@ var ScannerRegistry = class {
|
|
|
215926
216308
|
},
|
|
215927
216309
|
checkAvailable: async () => {
|
|
215928
216310
|
try {
|
|
215929
|
-
const { execFile:
|
|
215930
|
-
const { promisify:
|
|
215931
|
-
const
|
|
215932
|
-
await
|
|
216311
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216312
|
+
const { promisify: promisify11 } = await import("util");
|
|
216313
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216314
|
+
await execFileAsync10("bearer", ["--version"], { timeout: 5e3 });
|
|
215933
216315
|
return true;
|
|
215934
216316
|
} catch {
|
|
215935
216317
|
return false;
|
|
@@ -215959,6 +216341,90 @@ var ScannerRegistry = class {
|
|
|
215959
216341
|
};
|
|
215960
216342
|
}
|
|
215961
216343
|
});
|
|
216344
|
+
this.register({
|
|
216345
|
+
name: "trivy",
|
|
216346
|
+
version: "1.0.0",
|
|
216347
|
+
enabled: true,
|
|
216348
|
+
run: async (_filePaths, projectRoot, config) => {
|
|
216349
|
+
return await runTrivy(projectRoot, config);
|
|
216350
|
+
},
|
|
216351
|
+
checkAvailable: async () => {
|
|
216352
|
+
try {
|
|
216353
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216354
|
+
const { promisify: promisify11 } = await import("util");
|
|
216355
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216356
|
+
await execFileAsync10("trivy", ["--version"], { timeout: 5e3 });
|
|
216357
|
+
return true;
|
|
216358
|
+
} catch {
|
|
216359
|
+
return false;
|
|
216360
|
+
}
|
|
216361
|
+
},
|
|
216362
|
+
normalize: (finding, config) => {
|
|
216363
|
+
return {
|
|
216364
|
+
id: finding.id,
|
|
216365
|
+
severity: finding.severity,
|
|
216366
|
+
type: finding.type,
|
|
216367
|
+
category: finding.category,
|
|
216368
|
+
message: finding.message,
|
|
216369
|
+
file: finding.file,
|
|
216370
|
+
line: finding.line,
|
|
216371
|
+
column: finding.column,
|
|
216372
|
+
code: finding.code,
|
|
216373
|
+
aiScore: config.threshold,
|
|
216374
|
+
explainedScore: {
|
|
216375
|
+
score: config.threshold,
|
|
216376
|
+
band: "LOW",
|
|
216377
|
+
signalsTriggered: 0,
|
|
216378
|
+
variance: 0,
|
|
216379
|
+
topSignals: []
|
|
216380
|
+
},
|
|
216381
|
+
source: "trivy",
|
|
216382
|
+
ruleId: finding.ruleId
|
|
216383
|
+
};
|
|
216384
|
+
}
|
|
216385
|
+
});
|
|
216386
|
+
this.register({
|
|
216387
|
+
name: "horusec",
|
|
216388
|
+
version: "1.0.0",
|
|
216389
|
+
enabled: true,
|
|
216390
|
+
run: async (_filePaths, projectRoot, config) => {
|
|
216391
|
+
return await runHorusec(projectRoot, config);
|
|
216392
|
+
},
|
|
216393
|
+
checkAvailable: async () => {
|
|
216394
|
+
try {
|
|
216395
|
+
const { execFile: execFile10 } = await import("child_process");
|
|
216396
|
+
const { promisify: promisify11 } = await import("util");
|
|
216397
|
+
const execFileAsync10 = promisify11(execFile10);
|
|
216398
|
+
await execFileAsync10("horusec", ["version"], { timeout: 5e3 });
|
|
216399
|
+
return true;
|
|
216400
|
+
} catch {
|
|
216401
|
+
return false;
|
|
216402
|
+
}
|
|
216403
|
+
},
|
|
216404
|
+
normalize: (finding, config) => {
|
|
216405
|
+
return {
|
|
216406
|
+
id: finding.id,
|
|
216407
|
+
severity: finding.severity,
|
|
216408
|
+
type: finding.type,
|
|
216409
|
+
category: finding.category,
|
|
216410
|
+
message: finding.message,
|
|
216411
|
+
file: finding.file,
|
|
216412
|
+
line: finding.line,
|
|
216413
|
+
column: finding.column,
|
|
216414
|
+
code: finding.code,
|
|
216415
|
+
aiScore: config.threshold,
|
|
216416
|
+
explainedScore: {
|
|
216417
|
+
score: config.threshold,
|
|
216418
|
+
band: "LOW",
|
|
216419
|
+
signalsTriggered: 0,
|
|
216420
|
+
variance: 0,
|
|
216421
|
+
topSignals: []
|
|
216422
|
+
},
|
|
216423
|
+
source: "horusec",
|
|
216424
|
+
ruleId: finding.ruleId
|
|
216425
|
+
};
|
|
216426
|
+
}
|
|
216427
|
+
});
|
|
215962
216428
|
}
|
|
215963
216429
|
};
|
|
215964
216430
|
var scannerRegistry = new ScannerRegistry();
|
|
@@ -215992,7 +216458,7 @@ async function scanFiles(filePaths, configInput = {}, hooks = {}) {
|
|
|
215992
216458
|
findings: 0,
|
|
215993
216459
|
detail: "parse + score + local checks"
|
|
215994
216460
|
});
|
|
215995
|
-
const fileStat = await (0,
|
|
216461
|
+
const fileStat = await (0, import_promises4.stat)(filePath).catch(() => null);
|
|
215996
216462
|
if (!fileStat) {
|
|
215997
216463
|
processedFiles += 1;
|
|
215998
216464
|
hooks.onFileProgress?.({
|
|
@@ -216281,7 +216747,7 @@ function formatSigned(value) {
|
|
|
216281
216747
|
}
|
|
216282
216748
|
|
|
216283
216749
|
// src/commands/check.ts
|
|
216284
|
-
var
|
|
216750
|
+
var import_node_path12 = require("path");
|
|
216285
216751
|
|
|
216286
216752
|
// src/utils/console-buffer.ts
|
|
216287
216753
|
async function withBufferedAthenaCoreConsole(task) {
|
|
@@ -216324,11 +216790,11 @@ function normalizeCoreMessage(text) {
|
|
|
216324
216790
|
}
|
|
216325
216791
|
|
|
216326
216792
|
// src/utils/delta.ts
|
|
216327
|
-
var
|
|
216328
|
-
var
|
|
216329
|
-
var
|
|
216330
|
-
var ATHENA_DIR = (0,
|
|
216331
|
-
var SNAPSHOT_PATH = (0,
|
|
216793
|
+
var import_promises5 = require("fs/promises");
|
|
216794
|
+
var import_node_os2 = require("os");
|
|
216795
|
+
var import_node_path8 = require("path");
|
|
216796
|
+
var ATHENA_DIR = (0, import_node_path8.join)((0, import_node_os2.homedir)(), ".athena");
|
|
216797
|
+
var SNAPSHOT_PATH = (0, import_node_path8.join)(ATHENA_DIR, "scan-snapshots.json");
|
|
216332
216798
|
var severityWeights = {
|
|
216333
216799
|
CRITICAL: 8,
|
|
216334
216800
|
HIGH: 5,
|
|
@@ -216447,25 +216913,25 @@ function topFolderDeltas(current, previous) {
|
|
|
216447
216913
|
}
|
|
216448
216914
|
async function readSnapshots() {
|
|
216449
216915
|
try {
|
|
216450
|
-
return JSON.parse(await (0,
|
|
216916
|
+
return JSON.parse(await (0, import_promises5.readFile)(SNAPSHOT_PATH, "utf8"));
|
|
216451
216917
|
} catch {
|
|
216452
216918
|
return {};
|
|
216453
216919
|
}
|
|
216454
216920
|
}
|
|
216455
216921
|
async function writeSnapshots(snapshots) {
|
|
216456
|
-
await (0,
|
|
216457
|
-
await (0,
|
|
216922
|
+
await (0, import_promises5.mkdir)(ATHENA_DIR, { recursive: true });
|
|
216923
|
+
await (0, import_promises5.writeFile)(SNAPSHOT_PATH, `${JSON.stringify(snapshots, null, 2)}
|
|
216458
216924
|
`, "utf8");
|
|
216459
216925
|
}
|
|
216460
216926
|
function folderForPath(filePath, projectRoot) {
|
|
216461
|
-
const path = ((0,
|
|
216462
|
-
const folder = (0,
|
|
216927
|
+
const path = ((0, import_node_path8.isAbsolute)(filePath) ? (0, import_node_path8.relative)(projectRoot, filePath) : filePath).split("\\").join("/");
|
|
216928
|
+
const folder = (0, import_node_path8.dirname)(path).split("\\").join("/");
|
|
216463
216929
|
return folder === "." ? "<root>" : folder.split("/")[0] ?? "<root>";
|
|
216464
216930
|
}
|
|
216465
216931
|
|
|
216466
216932
|
// src/utils/file-filter.ts
|
|
216467
|
-
var
|
|
216468
|
-
var
|
|
216933
|
+
var import_promises6 = require("fs/promises");
|
|
216934
|
+
var import_node_path9 = require("path");
|
|
216469
216935
|
var supported = /* @__PURE__ */ new Set([".js", ".jsx", ".ts", ".tsx"]);
|
|
216470
216936
|
var ignoredDirs = /* @__PURE__ */ new Set([
|
|
216471
216937
|
"node_modules",
|
|
@@ -216492,7 +216958,7 @@ function isSourceFile(filePath) {
|
|
|
216492
216958
|
}
|
|
216493
216959
|
function isExcludedPath(filePath, root, excludes = []) {
|
|
216494
216960
|
if (excludes.length === 0) return false;
|
|
216495
|
-
const normalizedRelativePath = (0,
|
|
216961
|
+
const normalizedRelativePath = (0, import_node_path9.relative)(root, filePath).split("\\").join("/");
|
|
216496
216962
|
const relativeSegments = normalizedRelativePath.split("/").filter(Boolean);
|
|
216497
216963
|
return excludes.some((pattern) => {
|
|
216498
216964
|
const normalizedPattern = pattern.replace(/^\.\//, "").replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
@@ -216505,20 +216971,20 @@ function isExcludedPath(filePath, root, excludes = []) {
|
|
|
216505
216971
|
});
|
|
216506
216972
|
}
|
|
216507
216973
|
async function findSourceFiles(root, excludes = []) {
|
|
216508
|
-
const rootStat = await (0,
|
|
216974
|
+
const rootStat = await (0, import_promises6.stat)(root).catch(() => null);
|
|
216509
216975
|
if (!rootStat) return [];
|
|
216510
216976
|
if (rootStat.isFile()) return isSourceFile(root) && !isExcludedPath(root, root, excludes) ? [root] : [];
|
|
216511
216977
|
const output = [];
|
|
216512
|
-
await
|
|
216978
|
+
await walk2(root, root, output, excludes);
|
|
216513
216979
|
return output;
|
|
216514
216980
|
}
|
|
216515
|
-
async function
|
|
216516
|
-
const entries = await (0,
|
|
216981
|
+
async function walk2(dir, root, output, excludes) {
|
|
216982
|
+
const entries = await (0, import_promises6.readdir)(dir, { withFileTypes: true }).catch(() => []);
|
|
216517
216983
|
for (const entry of entries) {
|
|
216518
|
-
const fullPath = (0,
|
|
216984
|
+
const fullPath = (0, import_node_path9.join)(dir, entry.name);
|
|
216519
216985
|
if (entry.isDirectory()) {
|
|
216520
216986
|
if (!ignoredDirs.has(entry.name) && !isExcludedPath(fullPath, root, excludes)) {
|
|
216521
|
-
await
|
|
216987
|
+
await walk2(fullPath, root, output, excludes);
|
|
216522
216988
|
}
|
|
216523
216989
|
continue;
|
|
216524
216990
|
}
|
|
@@ -216529,16 +216995,16 @@ async function walk(dir, root, output, excludes) {
|
|
|
216529
216995
|
}
|
|
216530
216996
|
|
|
216531
216997
|
// src/utils/git.ts
|
|
216532
|
-
var
|
|
216533
|
-
var
|
|
216534
|
-
var
|
|
216998
|
+
var import_node_child_process8 = require("child_process");
|
|
216999
|
+
var import_node_util8 = require("util");
|
|
217000
|
+
var execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process8.execFile);
|
|
216535
217001
|
function logGitWarning(context, error) {
|
|
216536
217002
|
const message = error instanceof Error ? error.message : String(error);
|
|
216537
217003
|
console.warn(`[athena-cli] ${context}: ${message}`);
|
|
216538
217004
|
}
|
|
216539
217005
|
async function getGitRoot() {
|
|
216540
217006
|
try {
|
|
216541
|
-
const { stdout } = await
|
|
217007
|
+
const { stdout } = await execFileAsync8("git", ["rev-parse", "--show-toplevel"]);
|
|
216542
217008
|
return stdout.trim();
|
|
216543
217009
|
} catch (error) {
|
|
216544
217010
|
logGitWarning("Unable to resolve git root", error);
|
|
@@ -216547,7 +217013,7 @@ async function getGitRoot() {
|
|
|
216547
217013
|
}
|
|
216548
217014
|
async function getGitHooksDir() {
|
|
216549
217015
|
try {
|
|
216550
|
-
const { stdout } = await
|
|
217016
|
+
const { stdout } = await execFileAsync8("git", ["rev-parse", "--git-path", "hooks"]);
|
|
216551
217017
|
return stdout.trim();
|
|
216552
217018
|
} catch (error) {
|
|
216553
217019
|
logGitWarning("Unable to resolve git hooks directory", error);
|
|
@@ -216556,7 +217022,7 @@ async function getGitHooksDir() {
|
|
|
216556
217022
|
}
|
|
216557
217023
|
async function getStagedFiles() {
|
|
216558
217024
|
try {
|
|
216559
|
-
const { stdout } = await
|
|
217025
|
+
const { stdout } = await execFileAsync8("git", ["diff", "--cached", "--name-only", "--diff-filter=ACM"]);
|
|
216560
217026
|
return stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
|
|
216561
217027
|
} catch (error) {
|
|
216562
217028
|
logGitWarning("Unable to read staged files", error);
|
|
@@ -216565,11 +217031,11 @@ async function getStagedFiles() {
|
|
|
216565
217031
|
}
|
|
216566
217032
|
|
|
216567
217033
|
// src/utils/history.ts
|
|
216568
|
-
var
|
|
216569
|
-
var
|
|
216570
|
-
var
|
|
216571
|
-
var ATHENA_DIR2 = (0,
|
|
216572
|
-
var HISTORY_PATH = (0,
|
|
217034
|
+
var import_promises7 = require("fs/promises");
|
|
217035
|
+
var import_node_os3 = require("os");
|
|
217036
|
+
var import_node_path10 = require("path");
|
|
217037
|
+
var ATHENA_DIR2 = (0, import_node_path10.join)((0, import_node_os3.homedir)(), ".athena");
|
|
217038
|
+
var HISTORY_PATH = (0, import_node_path10.join)(ATHENA_DIR2, "scan-history.jsonl");
|
|
216573
217039
|
var MAX_HISTORY_LINES = 300;
|
|
216574
217040
|
function logHistoryWarning(context, error) {
|
|
216575
217041
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -216577,17 +217043,17 @@ function logHistoryWarning(context, error) {
|
|
|
216577
217043
|
}
|
|
216578
217044
|
async function appendScanHistory(entry) {
|
|
216579
217045
|
try {
|
|
216580
|
-
await (0,
|
|
217046
|
+
await (0, import_promises7.mkdir)(ATHENA_DIR2, { recursive: true });
|
|
216581
217047
|
let lines = [];
|
|
216582
217048
|
try {
|
|
216583
|
-
const existing = await (0,
|
|
217049
|
+
const existing = await (0, import_promises7.readFile)(HISTORY_PATH, "utf8");
|
|
216584
217050
|
lines = existing.split("\n").map((line) => line.trim()).filter(Boolean);
|
|
216585
217051
|
} catch (error) {
|
|
216586
217052
|
logHistoryWarning("History file not readable, starting new history", error);
|
|
216587
217053
|
}
|
|
216588
217054
|
lines.push(JSON.stringify(entry));
|
|
216589
217055
|
const trimmed = lines.slice(-MAX_HISTORY_LINES);
|
|
216590
|
-
await (0,
|
|
217056
|
+
await (0, import_promises7.writeFile)(HISTORY_PATH, `${trimmed.join("\n")}
|
|
216591
217057
|
`, "utf8");
|
|
216592
217058
|
} catch (error) {
|
|
216593
217059
|
logHistoryWarning("Failed to persist scan history", error);
|
|
@@ -216595,7 +217061,7 @@ async function appendScanHistory(entry) {
|
|
|
216595
217061
|
}
|
|
216596
217062
|
async function getRecentScanHistory(limit = 3) {
|
|
216597
217063
|
try {
|
|
216598
|
-
const content = await (0,
|
|
217064
|
+
const content = await (0, import_promises7.readFile)(HISTORY_PATH, "utf8");
|
|
216599
217065
|
const lines = content.split("\n").map((line) => line.trim()).filter(Boolean).slice(-Math.max(1, limit));
|
|
216600
217066
|
return lines.map((line) => {
|
|
216601
217067
|
try {
|
|
@@ -216628,7 +217094,7 @@ function formatRecentHistory(entries) {
|
|
|
216628
217094
|
}
|
|
216629
217095
|
|
|
216630
217096
|
// src/utils/scan-progress.ts
|
|
216631
|
-
var
|
|
217097
|
+
var import_node_path11 = require("path");
|
|
216632
217098
|
|
|
216633
217099
|
// src/utils/colors.ts
|
|
216634
217100
|
var c2 = {
|
|
@@ -216722,7 +217188,7 @@ function createScanProgressRenderer(enabled) {
|
|
|
216722
217188
|
onProgress: (event) => {
|
|
216723
217189
|
total = event.total;
|
|
216724
217190
|
currentPhase = formatPhase(event);
|
|
216725
|
-
currentFile = event.filePath ? (0,
|
|
217191
|
+
currentFile = event.filePath ? (0, import_node_path11.basename)(event.filePath) : "";
|
|
216726
217192
|
maybePrintMilestone(event);
|
|
216727
217193
|
if (event.status === "scanned" || event.status === "skipped" || event.status === "missing") {
|
|
216728
217194
|
processed = event.index;
|
|
@@ -216733,7 +217199,7 @@ function createScanProgressRenderer(enabled) {
|
|
|
216733
217199
|
},
|
|
216734
217200
|
onStage: (event) => {
|
|
216735
217201
|
currentPhase = formatPhase(event);
|
|
216736
|
-
currentFile = event.filePath ? (0,
|
|
217202
|
+
currentFile = event.filePath ? (0, import_node_path11.basename)(event.filePath) : "";
|
|
216737
217203
|
maybePrintMilestone(event);
|
|
216738
217204
|
if (event.phase === "external-scanners") {
|
|
216739
217205
|
total = Math.max(total, event.total);
|
|
@@ -216773,8 +217239,8 @@ function formatPhase(event) {
|
|
|
216773
217239
|
}
|
|
216774
217240
|
function formatMilestone(event) {
|
|
216775
217241
|
if (event.phase === "prepare") return "step 1/6 discover files";
|
|
216776
|
-
if (event.phase === "security-analysis") return `step 2/6 analyze ${(0,
|
|
216777
|
-
if (event.phase === "files" && event.status === "scanning") return `step 3/6 parse ${(0,
|
|
217242
|
+
if (event.phase === "security-analysis") return `step 2/6 analyze ${(0, import_node_path11.basename)(event.filePath)}`;
|
|
217243
|
+
if (event.phase === "files" && event.status === "scanning") return `step 3/6 parse ${(0, import_node_path11.basename)(event.filePath)}`;
|
|
216778
217244
|
if (event.phase === "files" && event.status === "scanned" && event.index === event.total) return "step 4/6 local file pass complete";
|
|
216779
217245
|
if (event.phase === "external-scanners") return `step 5/6 ${event.detail ?? "run external scanners"}`;
|
|
216780
217246
|
if (event.phase === "report") return "step 6/6 build report";
|
|
@@ -216836,8 +217302,10 @@ async function checkCommand(files, options) {
|
|
|
216836
217302
|
config.nodejsscan = { ...config.nodejsscan, enabled: options.nodejsscan !== false };
|
|
216837
217303
|
config.bearer = { ...config.bearer, enabled: options.bearer !== false };
|
|
216838
217304
|
config.semgrep.enabled = options.semgrep !== false;
|
|
217305
|
+
config.trivy = { ...config.trivy, enabled: options.trivy !== false };
|
|
217306
|
+
config.horusec = { ...config.horusec, enabled: options.horusec !== false };
|
|
216839
217307
|
const selected = files.length > 0 ? files : await getStagedFiles();
|
|
216840
|
-
const sourceFiles = selected.filter(isSourceFile).map((file) => (0,
|
|
217308
|
+
const sourceFiles = selected.filter(isSourceFile).map((file) => (0, import_node_path12.resolve)(process.cwd(), file)).filter((file) => !isExcludedPath(file, process.cwd(), config.exclude));
|
|
216841
217309
|
if (!options.quietHeader) {
|
|
216842
217310
|
if (process.stdout.isTTY) {
|
|
216843
217311
|
clearScreen();
|
|
@@ -216885,9 +217353,9 @@ function parseMaxFindings(raw) {
|
|
|
216885
217353
|
}
|
|
216886
217354
|
|
|
216887
217355
|
// src/commands/doctor.ts
|
|
216888
|
-
var
|
|
216889
|
-
var
|
|
216890
|
-
var
|
|
217356
|
+
var import_node_child_process9 = require("child_process");
|
|
217357
|
+
var import_node_util9 = require("util");
|
|
217358
|
+
var execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process9.execFile);
|
|
216891
217359
|
async function doctorCommand() {
|
|
216892
217360
|
const statuses = await Promise.all([
|
|
216893
217361
|
checkTool("node", ["--version"], "required runtime"),
|
|
@@ -216896,7 +217364,8 @@ async function doctorCommand() {
|
|
|
216896
217364
|
checkTool("eslint", ["--version"], "optional: JavaScript/TypeScript linting"),
|
|
216897
217365
|
checkTool("docker", ["--version"], "optional: required for nodejsscan"),
|
|
216898
217366
|
checkTool("bearer", ["--version"], "optional: privacy & data flow analysis"),
|
|
216899
|
-
checkTool("trivy", ["--version"], "optional: IaC/container/dependency findings")
|
|
217367
|
+
checkTool("trivy", ["--version"], "optional: IaC/container/dependency/misconfig findings"),
|
|
217368
|
+
checkTool("horusec", ["version"], "optional: multi-tool SAST orchestrator")
|
|
216900
217369
|
]);
|
|
216901
217370
|
console.log("Athena doctor\n");
|
|
216902
217371
|
for (const status of statuses) {
|
|
@@ -216922,10 +217391,18 @@ async function doctorCommand() {
|
|
|
216922
217391
|
if (!bearer?.ok) {
|
|
216923
217392
|
console.log(` ${c2.yellow}tip:${c2.reset} install Bearer with ${c2.bold}npm install -g @bearer/cli${c2.reset}`);
|
|
216924
217393
|
}
|
|
217394
|
+
const trivy = statuses.find((item) => item.name === "trivy");
|
|
217395
|
+
if (!trivy?.ok) {
|
|
217396
|
+
console.log(` ${c2.yellow}tip:${c2.reset} install Trivy from ${c2.bold}https://trivy.dev/latest/getting-started/installation/${c2.reset}`);
|
|
217397
|
+
}
|
|
217398
|
+
const horusec = statuses.find((item) => item.name === "horusec");
|
|
217399
|
+
if (!horusec?.ok) {
|
|
217400
|
+
console.log(` ${c2.yellow}tip:${c2.reset} install Horusec from ${c2.bold}https://github.com/ZupIT/horusec${c2.reset}`);
|
|
217401
|
+
}
|
|
216925
217402
|
}
|
|
216926
217403
|
async function checkTool(name, args, note) {
|
|
216927
217404
|
try {
|
|
216928
|
-
const { stdout, stderr } = await
|
|
217405
|
+
const { stdout, stderr } = await execFileAsync9(name, args, { timeout: 15e3, maxBuffer: 1024 * 1024 });
|
|
216929
217406
|
const raw = `${stdout}
|
|
216930
217407
|
${stderr}`.trim();
|
|
216931
217408
|
const line = raw.split(/\r?\n/).find((value) => value.trim().length > 0) ?? "ok";
|
|
@@ -216946,8 +217423,8 @@ ${stderr}`.trim();
|
|
|
216946
217423
|
}
|
|
216947
217424
|
|
|
216948
217425
|
// src/commands/init.ts
|
|
216949
|
-
var
|
|
216950
|
-
var
|
|
217426
|
+
var import_promises8 = require("fs/promises");
|
|
217427
|
+
var import_node_path13 = require("path");
|
|
216951
217428
|
async function initCommand() {
|
|
216952
217429
|
const root = await getGitRoot();
|
|
216953
217430
|
const hooksDir = await getGitHooksDir();
|
|
@@ -216956,14 +217433,14 @@ async function initCommand() {
|
|
|
216956
217433
|
process.exitCode = 1;
|
|
216957
217434
|
return;
|
|
216958
217435
|
}
|
|
216959
|
-
const hookPath = (0,
|
|
217436
|
+
const hookPath = (0, import_node_path13.join)(hooksDir, "pre-commit");
|
|
216960
217437
|
const hook = [
|
|
216961
217438
|
"#!/bin/sh",
|
|
216962
217439
|
'echo "athena: checking staged JS/TS files"',
|
|
216963
217440
|
"npx athena check"
|
|
216964
217441
|
].join("\n");
|
|
216965
|
-
await (0,
|
|
216966
|
-
await (0,
|
|
217442
|
+
await (0, import_promises8.mkdir)((0, import_node_path13.dirname)(hookPath), { recursive: true });
|
|
217443
|
+
await (0, import_promises8.writeFile)(hookPath, `${hook}
|
|
216967
217444
|
`, { mode: 493 });
|
|
216968
217445
|
console.log(`Athena pre-commit hook installed at ${hookPath}`);
|
|
216969
217446
|
}
|
|
@@ -216972,9 +217449,9 @@ async function initCommand() {
|
|
|
216972
217449
|
var import_node_readline = require("readline");
|
|
216973
217450
|
|
|
216974
217451
|
// src/commands/scan.ts
|
|
216975
|
-
var
|
|
217452
|
+
var import_node_path14 = require("path");
|
|
216976
217453
|
async function scanCommand(dir, options) {
|
|
216977
|
-
const root = (0,
|
|
217454
|
+
const root = (0, import_node_path14.resolve)(process.cwd(), dir);
|
|
216978
217455
|
const config = mergeConfig({
|
|
216979
217456
|
threshold: Number(options.threshold)
|
|
216980
217457
|
});
|
|
@@ -216983,6 +217460,8 @@ async function scanCommand(dir, options) {
|
|
|
216983
217460
|
config.nodejsscan = { ...config.nodejsscan, enabled: options.nodejsscan !== false };
|
|
216984
217461
|
config.bearer = { ...config.bearer, enabled: options.bearer !== false };
|
|
216985
217462
|
config.semgrep.enabled = options.semgrep !== false;
|
|
217463
|
+
config.trivy = { ...config.trivy, enabled: options.trivy !== false };
|
|
217464
|
+
config.horusec = { ...config.horusec, enabled: options.horusec !== false };
|
|
216986
217465
|
if (!options.quietHeader) {
|
|
216987
217466
|
if (process.stdout.isTTY) {
|
|
216988
217467
|
clearScreen();
|
|
@@ -217030,14 +217509,25 @@ function parseMaxFindings2(raw) {
|
|
|
217030
217509
|
}
|
|
217031
217510
|
|
|
217032
217511
|
// src/commands/setup.ts
|
|
217033
|
-
var
|
|
217034
|
-
var
|
|
217035
|
-
var execAsync = (0,
|
|
217512
|
+
var import_node_child_process10 = require("child_process");
|
|
217513
|
+
var import_node_util10 = require("util");
|
|
217514
|
+
var execAsync = (0, import_node_util10.promisify)(import_node_child_process10.exec);
|
|
217036
217515
|
function getSemgrepInstallCommand(platform) {
|
|
217037
217516
|
if (platform === "darwin") return "brew install semgrep";
|
|
217038
217517
|
if (platform === "win32") return "choco install semgrep -y";
|
|
217039
217518
|
return "python3 -m pip install --user semgrep";
|
|
217040
217519
|
}
|
|
217520
|
+
function getTrivyInstallCommand(platform) {
|
|
217521
|
+
if (platform === "darwin") return "brew install trivy";
|
|
217522
|
+
if (platform === "win32") return "choco install trivy -y";
|
|
217523
|
+
return void 0;
|
|
217524
|
+
}
|
|
217525
|
+
function getHorusecInstallCommand(platform) {
|
|
217526
|
+
if (platform === "win32") {
|
|
217527
|
+
return 'curl -k "https://github.com/ZupIT/horusec/releases/latest/download/horusec_win_amd64.exe" -o "./horusec.exe" -L';
|
|
217528
|
+
}
|
|
217529
|
+
return "curl -fsSL https://raw.githubusercontent.com/ZupIT/horusec/master/deployments/scripts/install.sh | bash -s latest";
|
|
217530
|
+
}
|
|
217041
217531
|
async function setupSemgrepCommand(options = {}) {
|
|
217042
217532
|
const installCommand = getSemgrepInstallCommand(process.platform);
|
|
217043
217533
|
console.log("Semgrep setup");
|
|
@@ -217089,6 +217579,20 @@ function getSetupAllPlan(platform) {
|
|
|
217089
217579
|
autoInstallCommand: "npm install -g @bearer/cli",
|
|
217090
217580
|
manualInstallCommand: "npm install -g @bearer/cli",
|
|
217091
217581
|
note: "External CLI scanner for privacy and data-flow analysis."
|
|
217582
|
+
},
|
|
217583
|
+
{
|
|
217584
|
+
name: "Trivy",
|
|
217585
|
+
includedWithAthena: false,
|
|
217586
|
+
autoInstallCommand: getTrivyInstallCommand(platform),
|
|
217587
|
+
manualInstallCommand: getTrivyInstallCommand(platform),
|
|
217588
|
+
note: "External unified scanner for dependency vulnerabilities, secrets, and misconfigurations."
|
|
217589
|
+
},
|
|
217590
|
+
{
|
|
217591
|
+
name: "Horusec",
|
|
217592
|
+
includedWithAthena: false,
|
|
217593
|
+
autoInstallCommand: getHorusecInstallCommand(platform),
|
|
217594
|
+
manualInstallCommand: getHorusecInstallCommand(platform),
|
|
217595
|
+
note: "External multi-language SAST orchestrator. Docker recommended for full analysis coverage."
|
|
217092
217596
|
}
|
|
217093
217597
|
];
|
|
217094
217598
|
}
|
|
@@ -217132,8 +217636,8 @@ Installing ${tool.name}...`);
|
|
|
217132
217636
|
}
|
|
217133
217637
|
|
|
217134
217638
|
// src/commands/uninstall.ts
|
|
217135
|
-
var
|
|
217136
|
-
var
|
|
217639
|
+
var import_promises9 = require("fs/promises");
|
|
217640
|
+
var import_node_path15 = require("path");
|
|
217137
217641
|
async function uninstallCommand() {
|
|
217138
217642
|
const root = await getGitRoot();
|
|
217139
217643
|
const hooksDir = await getGitHooksDir();
|
|
@@ -217142,15 +217646,15 @@ async function uninstallCommand() {
|
|
|
217142
217646
|
process.exitCode = 1;
|
|
217143
217647
|
return;
|
|
217144
217648
|
}
|
|
217145
|
-
const hookPath = (0,
|
|
217146
|
-
await (0,
|
|
217649
|
+
const hookPath = (0, import_node_path15.join)(hooksDir, "pre-commit");
|
|
217650
|
+
await (0, import_promises9.rm)(hookPath, { force: true });
|
|
217147
217651
|
console.log(`Athena pre-commit hook removed from ${hookPath}`);
|
|
217148
217652
|
}
|
|
217149
217653
|
|
|
217150
217654
|
// package.json
|
|
217151
217655
|
var package_default = {
|
|
217152
217656
|
name: "@arsh342/athena",
|
|
217153
|
-
version: "0.2.
|
|
217657
|
+
version: "0.2.4",
|
|
217154
217658
|
description: "AI code provenance tracker and terminal scanner for JavaScript and TypeScript repositories.",
|
|
217155
217659
|
type: "module",
|
|
217156
217660
|
bin: {
|
|
@@ -217304,7 +217808,7 @@ async function select(items) {
|
|
|
217304
217808
|
process.stdin.resume();
|
|
217305
217809
|
let index = 0;
|
|
217306
217810
|
render(items, index, historyText);
|
|
217307
|
-
return new Promise((
|
|
217811
|
+
return new Promise((resolve10) => {
|
|
217308
217812
|
const cleanup = () => {
|
|
217309
217813
|
process.stdin.setRawMode(false);
|
|
217310
217814
|
process.stdin.pause();
|
|
@@ -217312,7 +217816,7 @@ async function select(items) {
|
|
|
217312
217816
|
};
|
|
217313
217817
|
const done = (value) => {
|
|
217314
217818
|
cleanup();
|
|
217315
|
-
|
|
217819
|
+
resolve10(value);
|
|
217316
217820
|
};
|
|
217317
217821
|
const onKeypress = (_input, key) => {
|
|
217318
217822
|
if (key.ctrl && key.name === "c") done(null);
|
|
@@ -217384,7 +217888,7 @@ async function waitForReturnToMenu() {
|
|
|
217384
217888
|
(0, import_node_readline.emitKeypressEvents)(process.stdin);
|
|
217385
217889
|
process.stdin.setRawMode(true);
|
|
217386
217890
|
process.stdin.resume();
|
|
217387
|
-
await new Promise((
|
|
217891
|
+
await new Promise((resolve10) => {
|
|
217388
217892
|
const cleanup = () => {
|
|
217389
217893
|
process.stdin.setRawMode(false);
|
|
217390
217894
|
process.stdin.pause();
|
|
@@ -217392,7 +217896,7 @@ async function waitForReturnToMenu() {
|
|
|
217392
217896
|
};
|
|
217393
217897
|
const onKeypress = () => {
|
|
217394
217898
|
cleanup();
|
|
217395
|
-
|
|
217899
|
+
resolve10();
|
|
217396
217900
|
};
|
|
217397
217901
|
process.stdin.on("keypress", onKeypress);
|
|
217398
217902
|
});
|
|
@@ -217401,8 +217905,8 @@ async function waitForReturnToMenu() {
|
|
|
217401
217905
|
// src/index.ts
|
|
217402
217906
|
var program2 = new Command();
|
|
217403
217907
|
program2.name("athena").description("AI code provenance tracker for JavaScript and TypeScript repositories").version(CLI_VERSION);
|
|
217404
|
-
program2.command("scan").argument("[dir]", "directory to scan", ".").option("-t, --threshold <number>", "AI score threshold", "9").option("-f, --format <format>", "terminal | json | jsonl", "terminal").option("-m, --max-findings <number|all>", "max findings to print (default: all)", "all").option("--no-eslint", "disable ESLint scanner").option("--no-npm-audit", "disable npm audit scanner").option("--no-nodejsscan", "disable nodejsscan scanner").option("--no-bearer", "disable Bearer scanner").option("--no-semgrep", "disable Semgrep scanner").description("scan a directory recursively").action(scanCommand);
|
|
217405
|
-
program2.command("check").argument("[files...]", "files to check; defaults to staged JS/TS files").option("-t, --threshold <number>", "AI score threshold", "9").option("-f, --format <format>", "terminal | json | jsonl", "terminal").option("-m, --max-findings <number|all>", "max findings to print (default: all)", "all").option("--no-eslint", "disable ESLint scanner").option("--no-npm-audit", "disable npm audit scanner").option("--no-nodejsscan", "disable nodejsscan scanner").option("--no-bearer", "disable Bearer scanner").option("--no-semgrep", "disable Semgrep scanner").description("check changed files for blocking findings").action(checkCommand);
|
|
217908
|
+
program2.command("scan").argument("[dir]", "directory to scan", ".").option("-t, --threshold <number>", "AI score threshold", "9").option("-f, --format <format>", "terminal | json | jsonl", "terminal").option("-m, --max-findings <number|all>", "max findings to print (default: all)", "all").option("--no-eslint", "disable ESLint scanner").option("--no-npm-audit", "disable npm audit scanner").option("--no-nodejsscan", "disable nodejsscan scanner").option("--no-bearer", "disable Bearer scanner").option("--no-semgrep", "disable Semgrep scanner").option("--no-trivy", "disable Trivy scanner").option("--no-horusec", "disable Horusec scanner").description("scan a directory recursively").action(scanCommand);
|
|
217909
|
+
program2.command("check").argument("[files...]", "files to check; defaults to staged JS/TS files").option("-t, --threshold <number>", "AI score threshold", "9").option("-f, --format <format>", "terminal | json | jsonl", "terminal").option("-m, --max-findings <number|all>", "max findings to print (default: all)", "all").option("--no-eslint", "disable ESLint scanner").option("--no-npm-audit", "disable npm audit scanner").option("--no-nodejsscan", "disable nodejsscan scanner").option("--no-bearer", "disable Bearer scanner").option("--no-semgrep", "disable Semgrep scanner").option("--no-trivy", "disable Trivy scanner").option("--no-horusec", "disable Horusec scanner").description("check changed files for blocking findings").action(checkCommand);
|
|
217406
217910
|
program2.command("init").description("install Athena pre-commit hook").action(initCommand);
|
|
217407
217911
|
program2.command("uninstall").description("remove Athena pre-commit hook").action(uninstallCommand);
|
|
217408
217912
|
program2.command("doctor").description("check local toolchain health (node, npm, semgrep, trivy)").action(doctorCommand);
|