@arsh342/athena 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +11 -0
  2. package/dist/index.cjs +543 -213
  3. package/package.json +5 -1
package/dist/index.cjs CHANGED
@@ -5734,7 +5734,7 @@ var require_typescript = __commonJS({
5734
5734
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
5735
5735
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
5736
5736
  writeCommentRange: () => writeCommentRange,
5737
- writeFile: () => writeFile3,
5737
+ writeFile: () => writeFile5,
5738
5738
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
5739
5739
  zipWith: () => zipWith
5740
5740
  });
@@ -12066,7 +12066,7 @@ ${lanes.join("\n")}
12066
12066
  writeOutputIsTTY() {
12067
12067
  return process.stdout.isTTY;
12068
12068
  },
12069
- readFile: readFile3,
12069
+ readFile: readFile4,
12070
12070
  writeFile: writeFile22,
12071
12071
  watchFile: watchFile2,
12072
12072
  watchDirectory,
@@ -12272,7 +12272,7 @@ ${lanes.join("\n")}
12272
12272
  callback
12273
12273
  );
12274
12274
  }
12275
- function readFile3(fileName, _encoding) {
12275
+ function readFile4(fileName, _encoding) {
12276
12276
  let buffer;
12277
12277
  try {
12278
12278
  buffer = _fs.readFileSync(fileName);
@@ -12860,11 +12860,11 @@ ${lanes.join("\n")}
12860
12860
  return toComponents;
12861
12861
  }
12862
12862
  const components = toComponents.slice(start);
12863
- const relative = [];
12863
+ const relative3 = [];
12864
12864
  for (; start < fromComponents.length; start++) {
12865
- relative.push("..");
12865
+ relative3.push("..");
12866
12866
  }
12867
- return ["", ...relative, ...components];
12867
+ return ["", ...relative3, ...components];
12868
12868
  }
12869
12869
  function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
12870
12870
  Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
@@ -24377,7 +24377,7 @@ ${lanes.join("\n")}
24377
24377
  sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
24378
24378
  return combinePaths(newDirPath, sourceFilePath);
24379
24379
  }
24380
- function writeFile3(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
24380
+ function writeFile5(host, diagnostics, fileName, text, writeByteOrderMark, sourceFiles, data) {
24381
24381
  host.writeFile(
24382
24382
  fileName,
24383
24383
  text,
@@ -48828,7 +48828,7 @@ ${lanes.join("\n")}
48828
48828
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
48829
48829
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
48830
48830
  }
48831
- function parseCommandLineWorker(diagnostics, commandLine, readFile3) {
48831
+ function parseCommandLineWorker(diagnostics, commandLine, readFile4) {
48832
48832
  const options = {};
48833
48833
  let watchOptions;
48834
48834
  const fileNames = [];
@@ -48876,7 +48876,7 @@ ${lanes.join("\n")}
48876
48876
  }
48877
48877
  }
48878
48878
  function parseResponseFile(fileName) {
48879
- const text = tryReadFile(fileName, readFile3 || ((fileName2) => sys.readFile(fileName2)));
48879
+ const text = tryReadFile(fileName, readFile4 || ((fileName2) => sys.readFile(fileName2)));
48880
48880
  if (!isString(text)) {
48881
48881
  errors.push(text);
48882
48882
  return;
@@ -48979,8 +48979,8 @@ ${lanes.join("\n")}
48979
48979
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
48980
48980
  optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
48981
48981
  };
48982
- function parseCommandLine(commandLine, readFile3) {
48983
- return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile3);
48982
+ function parseCommandLine(commandLine, readFile4) {
48983
+ return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile4);
48984
48984
  }
48985
48985
  function getOptionFromName(optionName, allowShort) {
48986
48986
  return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
@@ -49062,8 +49062,8 @@ ${lanes.join("\n")}
49062
49062
  watchOptionsToExtend
49063
49063
  );
49064
49064
  }
49065
- function readConfigFile(fileName, readFile3) {
49066
- const textOrDiagnostic = tryReadFile(fileName, readFile3);
49065
+ function readConfigFile(fileName, readFile4) {
49066
+ const textOrDiagnostic = tryReadFile(fileName, readFile4);
49067
49067
  return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
49068
49068
  }
49069
49069
  function parseConfigFileTextToJson(fileName, jsonText) {
@@ -49078,14 +49078,14 @@ ${lanes.join("\n")}
49078
49078
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
49079
49079
  };
49080
49080
  }
49081
- function readJsonConfigFile(fileName, readFile3) {
49082
- const textOrDiagnostic = tryReadFile(fileName, readFile3);
49081
+ function readJsonConfigFile(fileName, readFile4) {
49082
+ const textOrDiagnostic = tryReadFile(fileName, readFile4);
49083
49083
  return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
49084
49084
  }
49085
- function tryReadFile(fileName, readFile3) {
49085
+ function tryReadFile(fileName, readFile4) {
49086
49086
  let text;
49087
49087
  try {
49088
- text = readFile3(fileName);
49088
+ text = readFile4(fileName);
49089
49089
  } catch (e2) {
49090
49090
  return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e2.message);
49091
49091
  }
@@ -57343,9 +57343,9 @@ ${lanes.join("\n")}
57343
57343
  if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
57344
57344
  return;
57345
57345
  }
57346
- const relative = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
57346
+ const relative3 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
57347
57347
  for (const symlinkDirectory of symlinkDirectories) {
57348
- const option = resolvePath(symlinkDirectory, relative);
57348
+ const option = resolvePath(symlinkDirectory, relative3);
57349
57349
  const result2 = cb(option, target === referenceRedirect);
57350
57350
  shouldFilterIgnoredPaths = true;
57351
57351
  if (result2) return result2;
@@ -133128,7 +133128,7 @@ ${lanes.join("\n")}
133128
133128
  return;
133129
133129
  }
133130
133130
  const buildInfo = host.getBuildInfo() || { version };
133131
- writeFile3(
133131
+ writeFile5(
133132
133132
  host,
133133
133133
  emitterDiagnostics,
133134
133134
  buildInfoPath,
@@ -133340,7 +133340,7 @@ ${lanes.join("\n")}
133340
133340
  }
133341
133341
  if (sourceMapFilePath) {
133342
133342
  const sourceMap = sourceMapGenerator.toString();
133343
- writeFile3(
133343
+ writeFile5(
133344
133344
  host,
133345
133345
  emitterDiagnostics,
133346
133346
  sourceMapFilePath,
@@ -133355,7 +133355,7 @@ ${lanes.join("\n")}
133355
133355
  }
133356
133356
  const text = writer.getText();
133357
133357
  const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
133358
- writeFile3(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
133358
+ writeFile5(host, emitterDiagnostics, jsFilePath, text, !!compilerOptions.emitBOM, sourceFiles, data);
133359
133359
  writer.clear();
133360
133360
  return !data.skippedDtsWrite;
133361
133361
  }
@@ -138743,12 +138743,12 @@ ${lanes.join("\n")}
138743
138743
  function createCompilerHost(options, setParentNodes) {
138744
138744
  return createCompilerHostWorker(options, setParentNodes);
138745
138745
  }
138746
- function createGetSourceFile(readFile3, setParentNodes) {
138746
+ function createGetSourceFile(readFile4, setParentNodes) {
138747
138747
  return (fileName, languageVersionOrOptions, onError) => {
138748
138748
  let text;
138749
138749
  try {
138750
138750
  mark("beforeIORead");
138751
- text = readFile3(fileName);
138751
+ text = readFile4(fileName);
138752
138752
  mark("afterIORead");
138753
138753
  measure("I/O Read", "beforeIORead", "afterIORead");
138754
138754
  } catch (e2) {
@@ -139652,7 +139652,7 @@ ${lanes.join("\n")}
139652
139652
  getRedirectFromOutput,
139653
139653
  forEachResolvedProjectReference: forEachResolvedProjectReference2
139654
139654
  });
139655
- const readFile3 = host.readFile.bind(host);
139655
+ const readFile4 = host.readFile.bind(host);
139656
139656
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
139657
139657
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
139658
139658
  (_f = tracing) == null ? void 0 : _f.pop();
@@ -139878,7 +139878,7 @@ ${lanes.join("\n")}
139878
139878
  shouldTransformImportCall,
139879
139879
  emitBuildInfo,
139880
139880
  fileExists,
139881
- readFile: readFile3,
139881
+ readFile: readFile4,
139882
139882
  directoryExists,
139883
139883
  getSymlinkCache,
139884
139884
  realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
@@ -201237,7 +201237,7 @@ ${options.prefix}` : "\n" : options.prefix
201237
201237
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
201238
201238
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
201239
201239
  writeCommentRange: () => writeCommentRange,
201240
- writeFile: () => writeFile3,
201240
+ writeFile: () => writeFile5,
201241
201241
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
201242
201242
  zipWith: () => zipWith
201243
201243
  });
@@ -278794,7 +278794,7 @@ var require_Str = __commonJS({
278794
278794
  "../node_modules/prelude-ls/lib/Str.js"(exports2, module2) {
278795
278795
  "use strict";
278796
278796
  var split;
278797
- var join5;
278797
+ var join7;
278798
278798
  var lines;
278799
278799
  var unlines;
278800
278800
  var words;
@@ -278809,7 +278809,7 @@ var require_Str = __commonJS({
278809
278809
  split = curry$(function(sep, str) {
278810
278810
  return str.split(sep);
278811
278811
  });
278812
- join5 = curry$(function(sep, xs) {
278812
+ join7 = curry$(function(sep, xs) {
278813
278813
  return xs.join(sep);
278814
278814
  });
278815
278815
  lines = function(str) {
@@ -278868,7 +278868,7 @@ var require_Str = __commonJS({
278868
278868
  };
278869
278869
  module2.exports = {
278870
278870
  split,
278871
- join: join5,
278871
+ join: join7,
278872
278872
  lines,
278873
278873
  unlines,
278874
278874
  words,
@@ -286776,51 +286776,51 @@ var require_uri_all = __commonJS({
286776
286776
  }
286777
286777
  return uriTokens.join("");
286778
286778
  }
286779
- function resolveComponents(base2, relative) {
286779
+ function resolveComponents(base2, relative3) {
286780
286780
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
286781
286781
  var skipNormalization = arguments[3];
286782
286782
  var target = {};
286783
286783
  if (!skipNormalization) {
286784
286784
  base2 = parse(serialize(base2, options), options);
286785
- relative = parse(serialize(relative, options), options);
286785
+ relative3 = parse(serialize(relative3, options), options);
286786
286786
  }
286787
286787
  options = options || {};
286788
- if (!options.tolerant && relative.scheme) {
286789
- target.scheme = relative.scheme;
286790
- target.userinfo = relative.userinfo;
286791
- target.host = relative.host;
286792
- target.port = relative.port;
286793
- target.path = removeDotSegments(relative.path || "");
286794
- target.query = relative.query;
286788
+ if (!options.tolerant && relative3.scheme) {
286789
+ target.scheme = relative3.scheme;
286790
+ target.userinfo = relative3.userinfo;
286791
+ target.host = relative3.host;
286792
+ target.port = relative3.port;
286793
+ target.path = removeDotSegments(relative3.path || "");
286794
+ target.query = relative3.query;
286795
286795
  } else {
286796
- if (relative.userinfo !== void 0 || relative.host !== void 0 || relative.port !== void 0) {
286797
- target.userinfo = relative.userinfo;
286798
- target.host = relative.host;
286799
- target.port = relative.port;
286800
- target.path = removeDotSegments(relative.path || "");
286801
- target.query = relative.query;
286796
+ if (relative3.userinfo !== void 0 || relative3.host !== void 0 || relative3.port !== void 0) {
286797
+ target.userinfo = relative3.userinfo;
286798
+ target.host = relative3.host;
286799
+ target.port = relative3.port;
286800
+ target.path = removeDotSegments(relative3.path || "");
286801
+ target.query = relative3.query;
286802
286802
  } else {
286803
- if (!relative.path) {
286803
+ if (!relative3.path) {
286804
286804
  target.path = base2.path;
286805
- if (relative.query !== void 0) {
286806
- target.query = relative.query;
286805
+ if (relative3.query !== void 0) {
286806
+ target.query = relative3.query;
286807
286807
  } else {
286808
286808
  target.query = base2.query;
286809
286809
  }
286810
286810
  } else {
286811
- if (relative.path.charAt(0) === "/") {
286812
- target.path = removeDotSegments(relative.path);
286811
+ if (relative3.path.charAt(0) === "/") {
286812
+ target.path = removeDotSegments(relative3.path);
286813
286813
  } else {
286814
286814
  if ((base2.userinfo !== void 0 || base2.host !== void 0 || base2.port !== void 0) && !base2.path) {
286815
- target.path = "/" + relative.path;
286815
+ target.path = "/" + relative3.path;
286816
286816
  } else if (!base2.path) {
286817
- target.path = relative.path;
286817
+ target.path = relative3.path;
286818
286818
  } else {
286819
- target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative.path;
286819
+ target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative3.path;
286820
286820
  }
286821
286821
  target.path = removeDotSegments(target.path);
286822
286822
  }
286823
- target.query = relative.query;
286823
+ target.query = relative3.query;
286824
286824
  }
286825
286825
  target.userinfo = base2.userinfo;
286826
286826
  target.host = base2.host;
@@ -286828,7 +286828,7 @@ var require_uri_all = __commonJS({
286828
286828
  }
286829
286829
  target.scheme = base2.scheme;
286830
286830
  }
286831
- target.fragment = relative.fragment;
286831
+ target.fragment = relative3.fragment;
286832
286832
  return target;
286833
286833
  }
286834
286834
  function resolve7(baseURI, relativeURI, options) {
@@ -295718,7 +295718,7 @@ var require_posix = __commonJS({
295718
295718
  assertPath(path2);
295719
295719
  if (path2.length === 0) return ".";
295720
295720
  }
295721
- function dirname2(path2) {
295721
+ function dirname3(path2) {
295722
295722
  if (path2 instanceof URL) {
295723
295723
  path2 = fromFileUrl(path2);
295724
295724
  }
@@ -295794,7 +295794,7 @@ var require_posix = __commonJS({
295794
295794
  assertArg$1(pathObject);
295795
295795
  return _format("/", pathObject);
295796
295796
  }
295797
- function isAbsolute(path2) {
295797
+ function isAbsolute2(path2) {
295798
295798
  assertPath(path2);
295799
295799
  return path2.length > 0 && isPosixPathSeparator(path2.charCodeAt(0));
295800
295800
  }
@@ -295861,15 +295861,15 @@ var require_posix = __commonJS({
295861
295861
  path2 = fromFileUrl(path2);
295862
295862
  }
295863
295863
  assertArg(path2);
295864
- const isAbsolute2 = isPosixPathSeparator(path2.charCodeAt(0));
295864
+ const isAbsolute3 = isPosixPathSeparator(path2.charCodeAt(0));
295865
295865
  const trailingSeparator = isPosixPathSeparator(path2.charCodeAt(path2.length - 1));
295866
- path2 = normalizeString(path2, !isAbsolute2, "/", isPosixPathSeparator);
295867
- if (path2.length === 0 && !isAbsolute2) path2 = ".";
295866
+ path2 = normalizeString(path2, !isAbsolute3, "/", isPosixPathSeparator);
295867
+ if (path2.length === 0 && !isAbsolute3) path2 = ".";
295868
295868
  if (path2.length > 0 && trailingSeparator) path2 += "/";
295869
- if (isAbsolute2) return `/${path2}`;
295869
+ if (isAbsolute3) return `/${path2}`;
295870
295870
  return path2;
295871
295871
  }
295872
- function join5(path2, ...paths) {
295872
+ function join7(path2, ...paths) {
295873
295873
  if (path2 === void 0) return ".";
295874
295874
  if (path2 instanceof URL) {
295875
295875
  path2 = fromFileUrl(path2);
@@ -295892,9 +295892,9 @@ var require_posix = __commonJS({
295892
295892
  name: ""
295893
295893
  };
295894
295894
  if (path2.length === 0) return ret;
295895
- const isAbsolute2 = isPosixPathSeparator(path2.charCodeAt(0));
295895
+ const isAbsolute3 = isPosixPathSeparator(path2.charCodeAt(0));
295896
295896
  let start;
295897
- if (isAbsolute2) {
295897
+ if (isAbsolute3) {
295898
295898
  ret.root = "/";
295899
295899
  start = 1;
295900
295900
  } else {
@@ -295930,7 +295930,7 @@ var require_posix = __commonJS({
295930
295930
  preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
295931
295931
  preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
295932
295932
  if (end !== -1) {
295933
- if (startPart === 0 && isAbsolute2) {
295933
+ if (startPart === 0 && isAbsolute3) {
295934
295934
  ret.base = ret.name = path2.slice(1, end);
295935
295935
  } else {
295936
295936
  ret.base = ret.name = path2.slice(startPart, end);
@@ -295938,7 +295938,7 @@ var require_posix = __commonJS({
295938
295938
  }
295939
295939
  ret.base = ret.base || "/";
295940
295940
  } else {
295941
- if (startPart === 0 && isAbsolute2) {
295941
+ if (startPart === 0 && isAbsolute3) {
295942
295942
  ret.name = path2.slice(1, startDot);
295943
295943
  ret.base = path2.slice(1, end);
295944
295944
  } else {
@@ -295949,7 +295949,7 @@ var require_posix = __commonJS({
295949
295949
  }
295950
295950
  if (startPart > 0) {
295951
295951
  ret.dir = stripTrailingSeparators(path2.slice(0, startPart - 1), isPosixPathSeparator);
295952
- } else if (isAbsolute2) ret.dir = "/";
295952
+ } else if (isAbsolute3) ret.dir = "/";
295953
295953
  return ret;
295954
295954
  }
295955
295955
  function resolve7(...pathSegments) {
@@ -295984,7 +295984,7 @@ var require_posix = __commonJS({
295984
295984
  assertPath(to);
295985
295985
  if (from === to) return "";
295986
295986
  }
295987
- function relative(from, to) {
295987
+ function relative3(from, to) {
295988
295988
  assertArgs(from, to);
295989
295989
  from = resolve7(from);
295990
295990
  to = resolve7(to);
@@ -296054,7 +296054,7 @@ var require_posix = __commonJS({
296054
296054
  });
296055
296055
  }
296056
296056
  function toFileUrl(path2) {
296057
- if (!isAbsolute(path2)) {
296057
+ if (!isAbsolute2(path2)) {
296058
296058
  throw new TypeError(`Path must be absolute: received "${path2}"`);
296059
296059
  }
296060
296060
  const url = new URL("file:///");
@@ -296347,7 +296347,7 @@ var require_posix = __commonJS({
296347
296347
  function joinGlobs(globs, options = {}) {
296348
296348
  const { globstar = false } = options;
296349
296349
  if (!globstar || globs.length === 0) {
296350
- return join5(...globs);
296350
+ return join7(...globs);
296351
296351
  }
296352
296352
  let joined;
296353
296353
  for (const glob of globs) {
@@ -296367,19 +296367,19 @@ var require_posix = __commonJS({
296367
296367
  exports2.SEPARATOR_PATTERN = SEPARATOR_PATTERN;
296368
296368
  exports2.basename = basename2;
296369
296369
  exports2.common = common;
296370
- exports2.dirname = dirname2;
296370
+ exports2.dirname = dirname3;
296371
296371
  exports2.extname = extname;
296372
296372
  exports2.format = format;
296373
296373
  exports2.fromFileUrl = fromFileUrl;
296374
296374
  exports2.globToRegExp = globToRegExp;
296375
- exports2.isAbsolute = isAbsolute;
296375
+ exports2.isAbsolute = isAbsolute2;
296376
296376
  exports2.isGlob = isGlob;
296377
- exports2.join = join5;
296377
+ exports2.join = join7;
296378
296378
  exports2.joinGlobs = joinGlobs;
296379
296379
  exports2.normalize = normalize;
296380
296380
  exports2.normalizeGlob = normalizeGlob;
296381
296381
  exports2.parse = parse;
296382
- exports2.relative = relative;
296382
+ exports2.relative = relative3;
296383
296383
  exports2.resolve = resolve7;
296384
296384
  exports2.toFileUrl = toFileUrl;
296385
296385
  exports2.toNamespacedPath = toNamespacedPath;
@@ -296500,7 +296500,7 @@ var require_windows = __commonJS({
296500
296500
  assertPath(path2);
296501
296501
  if (path2.length === 0) return ".";
296502
296502
  }
296503
- function dirname2(path2) {
296503
+ function dirname3(path2) {
296504
296504
  if (path2 instanceof URL) {
296505
296505
  path2 = fromFileUrl(path2);
296506
296506
  }
@@ -296624,7 +296624,7 @@ var require_windows = __commonJS({
296624
296624
  assertArg$1(pathObject);
296625
296625
  return _format("\\", pathObject);
296626
296626
  }
296627
- function isAbsolute(path2) {
296627
+ function isAbsolute2(path2) {
296628
296628
  assertPath(path2);
296629
296629
  const len = path2.length;
296630
296630
  if (len === 0) return false;
@@ -296704,11 +296704,11 @@ var require_windows = __commonJS({
296704
296704
  const len = path2.length;
296705
296705
  let rootEnd = 0;
296706
296706
  let device;
296707
- let isAbsolute2 = false;
296707
+ let isAbsolute3 = false;
296708
296708
  const code = path2.charCodeAt(0);
296709
296709
  if (len > 1) {
296710
296710
  if (isPathSeparator(code)) {
296711
- isAbsolute2 = true;
296711
+ isAbsolute3 = true;
296712
296712
  if (isPathSeparator(path2.charCodeAt(1))) {
296713
296713
  let j = 2;
296714
296714
  let last = j;
@@ -296743,7 +296743,7 @@ var require_windows = __commonJS({
296743
296743
  rootEnd = 2;
296744
296744
  if (len > 2) {
296745
296745
  if (isPathSeparator(path2.charCodeAt(2))) {
296746
- isAbsolute2 = true;
296746
+ isAbsolute3 = true;
296747
296747
  rootEnd = 3;
296748
296748
  }
296749
296749
  }
@@ -296754,27 +296754,27 @@ var require_windows = __commonJS({
296754
296754
  }
296755
296755
  let tail;
296756
296756
  if (rootEnd < len) {
296757
- tail = normalizeString(path2.slice(rootEnd), !isAbsolute2, "\\", isPathSeparator);
296757
+ tail = normalizeString(path2.slice(rootEnd), !isAbsolute3, "\\", isPathSeparator);
296758
296758
  } else {
296759
296759
  tail = "";
296760
296760
  }
296761
- if (tail.length === 0 && !isAbsolute2) tail = ".";
296761
+ if (tail.length === 0 && !isAbsolute3) tail = ".";
296762
296762
  if (tail.length > 0 && isPathSeparator(path2.charCodeAt(len - 1))) {
296763
296763
  tail += "\\";
296764
296764
  }
296765
296765
  if (device === void 0) {
296766
- if (isAbsolute2) {
296766
+ if (isAbsolute3) {
296767
296767
  if (tail.length > 0) return `\\${tail}`;
296768
296768
  else return "\\";
296769
296769
  }
296770
296770
  return tail;
296771
- } else if (isAbsolute2) {
296771
+ } else if (isAbsolute3) {
296772
296772
  if (tail.length > 0) return `${device}\\${tail}`;
296773
296773
  else return `${device}\\`;
296774
296774
  }
296775
296775
  return device + tail;
296776
296776
  }
296777
- function join5(path2, ...paths) {
296777
+ function join7(path2, ...paths) {
296778
296778
  if (path2 instanceof URL) {
296779
296779
  path2 = fromFileUrl(path2);
296780
296780
  }
@@ -296947,11 +296947,11 @@ var require_windows = __commonJS({
296947
296947
  if (len === 0) continue;
296948
296948
  let rootEnd = 0;
296949
296949
  let device = "";
296950
- let isAbsolute2 = false;
296950
+ let isAbsolute3 = false;
296951
296951
  const code = path2.charCodeAt(0);
296952
296952
  if (len > 1) {
296953
296953
  if (isPathSeparator(code)) {
296954
- isAbsolute2 = true;
296954
+ isAbsolute3 = true;
296955
296955
  if (isPathSeparator(path2.charCodeAt(1))) {
296956
296956
  let j = 2;
296957
296957
  let last = j;
@@ -296987,7 +296987,7 @@ var require_windows = __commonJS({
296987
296987
  rootEnd = 2;
296988
296988
  if (len > 2) {
296989
296989
  if (isPathSeparator(path2.charCodeAt(2))) {
296990
- isAbsolute2 = true;
296990
+ isAbsolute3 = true;
296991
296991
  rootEnd = 3;
296992
296992
  }
296993
296993
  }
@@ -296995,7 +296995,7 @@ var require_windows = __commonJS({
296995
296995
  }
296996
296996
  } else if (isPathSeparator(code)) {
296997
296997
  rootEnd = 1;
296998
- isAbsolute2 = true;
296998
+ isAbsolute3 = true;
296999
296999
  }
297000
297000
  if (device.length > 0 && resolvedDevice.length > 0 && device.toLowerCase() !== resolvedDevice.toLowerCase()) {
297001
297001
  continue;
@@ -297005,7 +297005,7 @@ var require_windows = __commonJS({
297005
297005
  }
297006
297006
  if (!resolvedAbsolute) {
297007
297007
  resolvedTail = `${path2.slice(rootEnd)}\\${resolvedTail}`;
297008
- resolvedAbsolute = isAbsolute2;
297008
+ resolvedAbsolute = isAbsolute3;
297009
297009
  }
297010
297010
  if (resolvedAbsolute && resolvedDevice.length > 0) break;
297011
297011
  }
@@ -297017,7 +297017,7 @@ var require_windows = __commonJS({
297017
297017
  assertPath(to);
297018
297018
  if (from === to) return "";
297019
297019
  }
297020
- function relative(from, to) {
297020
+ function relative3(from, to) {
297021
297021
  assertArgs(from, to);
297022
297022
  const fromOrig = resolve7(from);
297023
297023
  const toOrig = resolve7(to);
@@ -297102,7 +297102,7 @@ var require_windows = __commonJS({
297102
297102
  });
297103
297103
  }
297104
297104
  function toFileUrl(path2) {
297105
- if (!isAbsolute(path2)) {
297105
+ if (!isAbsolute2(path2)) {
297106
297106
  throw new TypeError(`Path must be absolute: received "${path2}"`);
297107
297107
  }
297108
297108
  const [, hostname, pathname] = path2.match(/^(?:[/\\]{2}([^/\\]+)(?=[/\\](?:[^/\\]|$)))?(.*)/);
@@ -297420,7 +297420,7 @@ var require_windows = __commonJS({
297420
297420
  function joinGlobs(globs, options = {}) {
297421
297421
  const { globstar = false } = options;
297422
297422
  if (!globstar || globs.length === 0) {
297423
- return join5(...globs);
297423
+ return join7(...globs);
297424
297424
  }
297425
297425
  let joined;
297426
297426
  for (const glob of globs) {
@@ -297440,19 +297440,19 @@ var require_windows = __commonJS({
297440
297440
  exports2.SEPARATOR_PATTERN = SEPARATOR_PATTERN;
297441
297441
  exports2.basename = basename2;
297442
297442
  exports2.common = common;
297443
- exports2.dirname = dirname2;
297443
+ exports2.dirname = dirname3;
297444
297444
  exports2.extname = extname;
297445
297445
  exports2.format = format;
297446
297446
  exports2.fromFileUrl = fromFileUrl;
297447
297447
  exports2.globToRegExp = globToRegExp;
297448
- exports2.isAbsolute = isAbsolute;
297448
+ exports2.isAbsolute = isAbsolute2;
297449
297449
  exports2.isGlob = isGlob;
297450
- exports2.join = join5;
297450
+ exports2.join = join7;
297451
297451
  exports2.joinGlobs = joinGlobs;
297452
297452
  exports2.normalize = normalize;
297453
297453
  exports2.normalizeGlob = normalizeGlob;
297454
297454
  exports2.parse = parse;
297455
- exports2.relative = relative;
297455
+ exports2.relative = relative3;
297456
297456
  exports2.resolve = resolve7;
297457
297457
  exports2.toFileUrl = toFileUrl;
297458
297458
  exports2.toNamespacedPath = toNamespacedPath;
@@ -308328,11 +308328,11 @@ var require_eslint = __commonJS({
308328
308328
  }, {});
308329
308329
  }
308330
308330
  var usedDeprecatedRulesCache = /* @__PURE__ */ new WeakMap();
308331
- function getOrFindUsedDeprecatedRules(eslint2, maybeFilePath) {
308331
+ function getOrFindUsedDeprecatedRules(eslint, maybeFilePath) {
308332
308332
  const {
308333
308333
  options: { cwd },
308334
308334
  configLoader
308335
- } = privateMembers.get(eslint2);
308335
+ } = privateMembers.get(eslint);
308336
308336
  const filePath = path2.isAbsolute(maybeFilePath) ? maybeFilePath : getPlaceholderPath(cwd);
308337
308337
  const configs = configLoader.getCachedConfigArrayForFile(filePath);
308338
308338
  const config = configs.getConfig(filePath);
@@ -308361,12 +308361,12 @@ var require_eslint = __commonJS({
308361
308361
  }
308362
308362
  return config ? usedDeprecatedRulesCache.get(config) : Object.freeze([]);
308363
308363
  }
308364
- function processLintReport(eslint2, results) {
308364
+ function processLintReport(eslint, results) {
308365
308365
  const descriptor = {
308366
308366
  configurable: true,
308367
308367
  enumerable: true,
308368
308368
  get() {
308369
- return getOrFindUsedDeprecatedRules(eslint2, this.filePath);
308369
+ return getOrFindUsedDeprecatedRules(eslint, this.filePath);
308370
308370
  }
308371
308371
  };
308372
308372
  for (const result of results) {
@@ -308422,13 +308422,13 @@ var require_eslint = __commonJS({
308422
308422
  const results = lintResultCache.getValidCachedLintResults(filePath, config);
308423
308423
  return !results || fix && results.messages && results.messages.length > 0;
308424
308424
  }
308425
- function calculateAutoWorkerCount(eslint2, filePaths, maxWorkers) {
308425
+ function calculateAutoWorkerCount(eslint, filePaths, maxWorkers) {
308426
308426
  const startTime = hrtimeBigint();
308427
308427
  const {
308428
308428
  configLoader,
308429
308429
  lintResultCache,
308430
308430
  options: { cacheStrategy, fix }
308431
- } = privateMembers.get(eslint2);
308431
+ } = privateMembers.get(eslint);
308432
308432
  const countAllMatched = !lintResultCache || cacheStrategy === "content";
308433
308433
  let processableFileCount = 0;
308434
308434
  let remainingFiles = filePaths.length;
@@ -308462,14 +308462,14 @@ var require_eslint = __commonJS({
308462
308462
  );
308463
308463
  return lowWorkerCount;
308464
308464
  }
308465
- function calculateWorkerCount(eslint2, filePaths, { availableParallelism } = os) {
308466
- const { concurrency } = privateMembers.get(eslint2).options;
308465
+ function calculateWorkerCount(eslint, filePaths, { availableParallelism } = os) {
308466
+ const { concurrency } = privateMembers.get(eslint).options;
308467
308467
  switch (concurrency) {
308468
308468
  case "off":
308469
308469
  return 0;
308470
308470
  case "auto": {
308471
308471
  const maxWorkers = availableParallelism() >> 1;
308472
- return calculateAutoWorkerCount(eslint2, filePaths, maxWorkers);
308472
+ return calculateAutoWorkerCount(eslint, filePaths, maxWorkers);
308473
308473
  }
308474
308474
  default: {
308475
308475
  const workerCount = Math.min(concurrency, filePaths.length);
@@ -308543,8 +308543,8 @@ var require_eslint = __commonJS({
308543
308543
  }
308544
308544
  return results;
308545
308545
  }
308546
- async function lintFilesWithMultithreading(eslint2, filePaths, workerCount, eslintOptionsOrURL, warnOnLowNetLintingRatio) {
308547
- const { configLoader, lintResultCache } = privateMembers.get(eslint2);
308546
+ async function lintFilesWithMultithreading(eslint, filePaths, workerCount, eslintOptionsOrURL, warnOnLowNetLintingRatio) {
308547
+ const { configLoader, lintResultCache } = privateMembers.get(eslint);
308548
308548
  const results = await runWorkers(
308549
308549
  filePaths,
308550
308550
  workerCount,
@@ -308569,13 +308569,13 @@ var require_eslint = __commonJS({
308569
308569
  }
308570
308570
  return results;
308571
308571
  }
308572
- async function lintFilesWithoutMultithreading(eslint2, filePaths) {
308572
+ async function lintFilesWithoutMultithreading(eslint, filePaths) {
308573
308573
  const {
308574
308574
  configLoader,
308575
308575
  linter,
308576
308576
  lintResultCache,
308577
308577
  options: eslintOptions
308578
- } = privateMembers.get(eslint2);
308578
+ } = privateMembers.get(eslint);
308579
308579
  const controller = new AbortController();
308580
308580
  const retrier = new Retrier2((error) => fileRetryCodes.has(error.code), {
308581
308581
  concurrency: 100
@@ -308754,11 +308754,11 @@ var require_eslint = __commonJS({
308754
308754
  const optionsURLString = optionsURL.href;
308755
308755
  const loadedOptions = await loadOptionsFromModule(optionsURLString);
308756
308756
  const options = { ...loadedOptions, [disableCloneabilityCheck]: true };
308757
- const eslint2 = new _ESLint(options);
308757
+ const eslint = new _ESLint(options);
308758
308758
  if (options.concurrency !== "off") {
308759
- eslint2.#optionsOrURL = optionsURLString;
308759
+ eslint.#optionsOrURL = optionsURLString;
308760
308760
  }
308761
- return eslint2;
308761
+ return eslint;
308762
308762
  }
308763
308763
  /**
308764
308764
  * Returns meta objects for each rule represented in the lint results.
@@ -309039,7 +309039,7 @@ Error: ${ex.message}`;
309039
309039
  `Formatter must be a function, but got a ${typeof formatter}.`
309040
309040
  );
309041
309041
  }
309042
- const eslint2 = this;
309042
+ const eslint = this;
309043
309043
  return {
309044
309044
  /**
309045
309045
  * The main formatter method.
@@ -309055,7 +309055,7 @@ Error: ${ex.message}`;
309055
309055
  cwd,
309056
309056
  get rulesMeta() {
309057
309057
  if (!rulesMeta) {
309058
- rulesMeta = eslint2.getRulesMetaForResults(results);
309058
+ rulesMeta = eslint.getRulesMetaForResults(results);
309059
309059
  }
309060
309060
  return rulesMeta;
309061
309061
  }
@@ -309402,7 +309402,7 @@ var require_eslintrc = __commonJS({
309402
309402
  }
309403
309403
  return resolvedResult;
309404
309404
  }
309405
- function relative(from, to) {
309405
+ function relative3(from, to) {
309406
309406
  const relPath = path__default["default"].relative(from, to);
309407
309407
  if (path__default["default"].sep === "/") {
309408
309408
  return relPath;
@@ -309454,7 +309454,7 @@ var require_eslintrc = __commonJS({
309454
309454
  return Object.assign(
309455
309455
  (filePath, dot = false) => {
309456
309456
  assert__default["default"](path__default["default"].isAbsolute(filePath), "'filePath' should be an absolute path.");
309457
- const relPathRaw = relative(basePath, filePath);
309457
+ const relPathRaw = relative3(basePath, filePath);
309458
309458
  const relPath = relPathRaw && relPathRaw + dirSuffix(filePath);
309459
309459
  const adoptedIg = dot ? dotIg : ig;
309460
309460
  const result = relPath !== "" && adoptedIg.ignores(relPath);
@@ -309488,7 +309488,7 @@ var require_eslintrc = __commonJS({
309488
309488
  if (newBasePath === basePath) {
309489
309489
  return patterns;
309490
309490
  }
309491
- const prefix = `/${relative(newBasePath, basePath)}`;
309491
+ const prefix = `/${relative3(newBasePath, basePath)}`;
309492
309492
  return patterns.map((pattern) => {
309493
309493
  const negative = pattern.startsWith("!");
309494
309494
  const head = negative ? "!" : "";
@@ -310891,14 +310891,14 @@ Require stack:
310891
310891
  function isFilePath(nameOrPath) {
310892
310892
  return /^\.{1,2}[/\\]/u.test(nameOrPath) || path__default["default"].isAbsolute(nameOrPath);
310893
310893
  }
310894
- function readFile3(filePath) {
310894
+ function readFile4(filePath) {
310895
310895
  return fs__default["default"].readFileSync(filePath, "utf8").replace(/^\ufeff/u, "");
310896
310896
  }
310897
310897
  function loadYAMLConfigFile(filePath) {
310898
310898
  debug$2(`Loading YAML config file: ${filePath}`);
310899
310899
  const yaml = require$1("js-yaml");
310900
310900
  try {
310901
- return yaml.load(readFile3(filePath)) || {};
310901
+ return yaml.load(readFile4(filePath)) || {};
310902
310902
  } catch (e2) {
310903
310903
  debug$2(`Error reading YAML file: ${filePath}`);
310904
310904
  e2.message = `Cannot read config file: ${filePath}
@@ -310909,7 +310909,7 @@ Error: ${e2.message}`;
310909
310909
  function loadJSONConfigFile(filePath) {
310910
310910
  debug$2(`Loading JSON config file: ${filePath}`);
310911
310911
  try {
310912
- return JSON.parse(stripComments__default["default"](readFile3(filePath)));
310912
+ return JSON.parse(stripComments__default["default"](readFile4(filePath)));
310913
310913
  } catch (e2) {
310914
310914
  debug$2(`Error reading JSON file: ${filePath}`);
310915
310915
  e2.message = `Cannot read config file: ${filePath}
@@ -310926,7 +310926,7 @@ Error: ${e2.message}`;
310926
310926
  debug$2(`Loading legacy config file: ${filePath}`);
310927
310927
  const yaml = require$1("js-yaml");
310928
310928
  try {
310929
- return yaml.load(stripComments__default["default"](readFile3(filePath))) || /* istanbul ignore next */
310929
+ return yaml.load(stripComments__default["default"](readFile4(filePath))) || /* istanbul ignore next */
310930
310930
  {};
310931
310931
  } catch (e2) {
310932
310932
  debug$2("Error reading YAML file: %s\n%o", filePath, e2);
@@ -310967,7 +310967,7 @@ Error: ${e2.message}`;
310967
310967
  function loadESLintIgnoreFile(filePath) {
310968
310968
  debug$2(`Loading .eslintignore file: ${filePath}`);
310969
310969
  try {
310970
- return readFile3(filePath).split(/\r?\n/gu).filter((line) => line.trim() !== "" && !line.startsWith("#"));
310970
+ return readFile4(filePath).split(/\r?\n/gu).filter((line) => line.trim() !== "" && !line.startsWith("#"));
310971
310971
  } catch (e2) {
310972
310972
  debug$2(`Error reading .eslintignore file: ${filePath}`);
310973
310973
  e2.message = `Cannot read .eslintignore file: ${filePath}
@@ -313611,7 +313611,7 @@ var require_legacy_eslint = __commonJS({
313611
313611
  }
313612
313612
  } = require_eslintrc();
313613
313613
  var { version } = require_package();
313614
- var writeFile3 = promisify8(fs.writeFile);
313614
+ var writeFile5 = promisify8(fs.writeFile);
313615
313615
  var privateMembersMap = /* @__PURE__ */ new WeakMap();
313616
313616
  function isNonEmptyString(value) {
313617
313617
  return typeof value === "string" && value.trim() !== "";
@@ -313933,7 +313933,7 @@ var require_legacy_eslint = __commonJS({
313933
313933
  throw new Error("'results' must include only objects");
313934
313934
  }
313935
313935
  return typeof result.output === "string" && path2.isAbsolute(result.filePath);
313936
- }).map((r2) => writeFile3(r2.filePath, r2.output))
313936
+ }).map((r2) => writeFile5(r2.filePath, r2.output))
313937
313937
  );
313938
313938
  }
313939
313939
  /**
@@ -315369,7 +315369,7 @@ function mergeConfig(config = {}) {
315369
315369
  }
315370
315370
 
315371
315371
  // ../core/dist/engine.js
315372
- var import_promises3 = require("fs/promises");
315372
+ var import_promises4 = require("fs/promises");
315373
315373
 
315374
315374
  // ../core/dist/analyzers/hallucination-detector.js
315375
315375
  var import_node_crypto = require("crypto");
@@ -316028,6 +316028,8 @@ function formatSemgrepType(ruleId) {
316028
316028
 
316029
316029
  // ../core/dist/analyzers/eslint-adapter.js
316030
316030
  var import_node_crypto5 = require("crypto");
316031
+ var import_promises3 = require("fs/promises");
316032
+ var import_node_path3 = require("path");
316031
316033
  async function runESLint(filePaths, config) {
316032
316034
  if (!config.enabled || filePaths.length === 0)
316033
316035
  return [];
@@ -316038,24 +316040,19 @@ async function runESLint(filePaths, config) {
316038
316040
  console.warn("[athena-core] ESLint module structure not supported; skipping ESLint scan");
316039
316041
  return [];
316040
316042
  }
316041
- const eslint2 = new ESLintClass({
316042
- useEslintrc: false,
316043
- overrideConfig: {
316044
- plugins: ["security"],
316045
- rules: getSecurityRules(config.rules),
316046
- env: {
316047
- node: true,
316048
- browser: true,
316049
- es2021: true
316050
- },
316051
- parserOptions: {
316052
- ecmaVersion: "latest",
316053
- sourceType: "module"
316054
- }
316055
- }
316056
- });
316057
- const results = await eslint2.lintFiles(filePaths);
316058
- return results.flatMap((result) => result.messages.map((msg) => normalizeESLintFinding(result.filePath, msg)));
316043
+ const { tempConfigPath } = await createTempFlatConfig(config.rules, process.cwd());
316044
+ try {
316045
+ const eslint = new ESLintClass({
316046
+ cwd: process.cwd(),
316047
+ overrideConfigFile: tempConfigPath,
316048
+ ignore: false
316049
+ });
316050
+ const results = await eslint.lintFiles(filePaths);
316051
+ return results.flatMap((result) => result.messages.map((msg) => normalizeESLintFinding(result.filePath, msg)));
316052
+ } finally {
316053
+ await (0, import_promises3.unlink)(tempConfigPath).catch(() => {
316054
+ });
316055
+ }
316059
316056
  } catch (error) {
316060
316057
  const withMessage = error;
316061
316058
  if (withMessage?.code === "MODULE_NOT_FOUND") {
@@ -316067,6 +316064,39 @@ async function runESLint(filePaths, config) {
316067
316064
  return [];
316068
316065
  }
316069
316066
  }
316067
+ async function createTempFlatConfig(customRules, baseDir) {
316068
+ const rules = getSecurityRules(customRules);
316069
+ const configContent = `
316070
+ import security from 'eslint-plugin-security';
316071
+
316072
+ export default [
316073
+ {
316074
+ plugins: {
316075
+ security,
316076
+ },
316077
+ rules: ${JSON.stringify(rules, null, 2)},
316078
+ languageOptions: {
316079
+ ecmaVersion: 'latest',
316080
+ sourceType: 'module',
316081
+ globals: {
316082
+ process: 'readonly',
316083
+ Buffer: 'readonly',
316084
+ __dirname: 'readonly',
316085
+ __filename: 'readonly',
316086
+ window: 'readonly',
316087
+ document: 'readonly',
316088
+ console: 'readonly',
316089
+ },
316090
+ },
316091
+ },
316092
+ ];
316093
+ `;
316094
+ const tempDir = baseDir || process.cwd();
316095
+ await (0, import_promises3.mkdir)(tempDir, { recursive: true });
316096
+ const tempConfigPath = (0, import_node_path3.join)(tempDir, `.athena-eslint-config-${Date.now()}.mjs`);
316097
+ await (0, import_promises3.writeFile)(tempConfigPath, configContent, "utf-8");
316098
+ return { tempConfigPath };
316099
+ }
316070
316100
  function getSecurityRules(customRules) {
316071
316101
  const defaultSecurityRules = {
316072
316102
  // Security rules from eslint-plugin-security
@@ -316139,7 +316169,7 @@ function getESLintCategory(ruleId) {
316139
316169
  var import_node_crypto6 = require("crypto");
316140
316170
  var import_node_child_process2 = require("child_process");
316141
316171
  var import_node_util2 = require("util");
316142
- var import_node_path3 = require("path");
316172
+ var import_node_path4 = require("path");
316143
316173
  var execFileAsync2 = (0, import_node_util2.promisify)(import_node_child_process2.execFile);
316144
316174
  async function runNpmAudit(projectRoot, config) {
316145
316175
  if (!config.enabled)
@@ -316189,7 +316219,7 @@ function normalizeNpmAuditFindings(advisory, projectRoot) {
316189
316219
  const findings = [];
316190
316220
  for (const finding of advisory.findings) {
316191
316221
  for (const path2 of finding.paths) {
316192
- const packageJsonPath = (0, import_node_path3.resolve)(projectRoot, "package.json");
316222
+ const packageJsonPath = (0, import_node_path4.resolve)(projectRoot, "package.json");
316193
316223
  findings.push({
316194
316224
  id: (0, import_node_crypto6.createHash)("sha1").update(`npm-audit:${advisory.id}:${path2}`).digest("hex").slice(0, 10),
316195
316225
  ruleId: `npm-audit:${advisory.id}`,
@@ -316222,7 +316252,7 @@ function mapNpmAuditSeverity(severity) {
316222
316252
  var import_node_crypto7 = require("crypto");
316223
316253
  var import_node_child_process3 = require("child_process");
316224
316254
  var import_node_util3 = require("util");
316225
- var import_node_path4 = require("path");
316255
+ var import_node_path5 = require("path");
316226
316256
  var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process3.execFile);
316227
316257
  async function runNodejsscan(projectRoot, config) {
316228
316258
  if (!config.enabled)
@@ -316293,7 +316323,7 @@ function safeParseNodejsscan(json) {
316293
316323
  }
316294
316324
  }
316295
316325
  function normalizeNodejsscanFinding(result, projectRoot) {
316296
- const file = (0, import_node_path4.resolve)(projectRoot, result.file || "");
316326
+ const file = (0, import_node_path5.resolve)(projectRoot, result.file || "");
316297
316327
  if (!file)
316298
316328
  return null;
316299
316329
  const line = result.line || 1;
@@ -316348,7 +316378,7 @@ function getNodejsscanCategory(issue) {
316348
316378
  var import_node_crypto8 = require("crypto");
316349
316379
  var import_node_child_process4 = require("child_process");
316350
316380
  var import_node_util4 = require("util");
316351
- var import_node_path5 = require("path");
316381
+ var import_node_path6 = require("path");
316352
316382
  var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process4.execFile);
316353
316383
  async function runBearer(projectRoot, config) {
316354
316384
  if (!config.enabled)
@@ -316412,7 +316442,7 @@ function normalizeBearerFinding(finding, projectRoot) {
316412
316442
  const filePath = finding.file?.path;
316413
316443
  if (!filePath)
316414
316444
  return null;
316415
- const file = (0, import_node_path5.resolve)(projectRoot, filePath);
316445
+ const file = (0, import_node_path6.resolve)(projectRoot, filePath);
316416
316446
  const line = finding.file?.line || 1;
316417
316447
  const column = finding.file?.column || 1;
316418
316448
  const code = finding.snippet?.code || "";
@@ -316780,7 +316810,7 @@ async function scanFiles(filePaths, configInput = {}, hooks = {}) {
316780
316810
  status: "scanning",
316781
316811
  findings: 0
316782
316812
  });
316783
- const fileStat = await (0, import_promises3.stat)(filePath).catch(() => null);
316813
+ const fileStat = await (0, import_promises4.stat)(filePath).catch(() => null);
316784
316814
  if (!fileStat) {
316785
316815
  processedFiles += 1;
316786
316816
  hooks.onFileProgress?.({
@@ -317012,11 +317042,191 @@ function formatCodeSnippet(code, maxLines) {
317012
317042
  }
317013
317043
 
317014
317044
  // src/commands/check.ts
317015
- var import_node_path9 = require("path");
317045
+ var import_node_path11 = require("path");
317046
+
317047
+ // src/utils/console-buffer.ts
317048
+ async function withBufferedAthenaCoreConsole(task) {
317049
+ const messages = [];
317050
+ const originalLog = console.log;
317051
+ const originalWarn = console.warn;
317052
+ console.log = (...args) => {
317053
+ if (captureMessage("log", args, messages)) return;
317054
+ originalLog(...args);
317055
+ };
317056
+ console.warn = (...args) => {
317057
+ if (captureMessage("warn", args, messages)) return;
317058
+ originalWarn(...args);
317059
+ };
317060
+ try {
317061
+ return {
317062
+ result: await task(),
317063
+ messages
317064
+ };
317065
+ } finally {
317066
+ console.log = originalLog;
317067
+ console.warn = originalWarn;
317068
+ }
317069
+ }
317070
+ function captureMessage(level, args, messages) {
317071
+ const text = args.map((arg) => String(arg)).join(" ");
317072
+ if (!text.startsWith("[athena-core]")) return false;
317073
+ messages.push({
317074
+ level,
317075
+ text: normalizeCoreMessage(text)
317076
+ });
317077
+ return true;
317078
+ }
317079
+ function normalizeCoreMessage(text) {
317080
+ const firstLine = text.replace(/^\[athena-core\]\s*/, "").split(/\r?\n/).map((line) => line.trim()).filter(Boolean)[0] ?? text;
317081
+ if (firstLine.includes("dockerDesktopLinuxEngine") || firstLine.includes("docker: error during connect")) {
317082
+ return "nodejsscan skipped because Docker is not running or not reachable";
317083
+ }
317084
+ return firstLine;
317085
+ }
317086
+
317087
+ // src/utils/delta.ts
317088
+ var import_promises5 = require("fs/promises");
317089
+ var import_node_os = require("os");
317090
+ var import_node_path7 = require("path");
317091
+ var ATHENA_DIR = (0, import_node_path7.join)((0, import_node_os.homedir)(), ".athena");
317092
+ var SNAPSHOT_PATH = (0, import_node_path7.join)(ATHENA_DIR, "scan-snapshots.json");
317093
+ var severityWeights = {
317094
+ CRITICAL: 8,
317095
+ HIGH: 5,
317096
+ MEDIUM: 2,
317097
+ LOW: 1
317098
+ };
317099
+ var emptySeverityCounts = {
317100
+ CRITICAL: 0,
317101
+ HIGH: 0,
317102
+ MEDIUM: 0,
317103
+ LOW: 0
317104
+ };
317105
+ async function attachScanDelta(report, targetKey, projectRoot) {
317106
+ try {
317107
+ const snapshots = await readSnapshots();
317108
+ const previous = snapshots[targetKey];
317109
+ const current = createSnapshot(report, targetKey, projectRoot);
317110
+ report.summary.delta = computeDelta(current, previous);
317111
+ snapshots[targetKey] = current;
317112
+ await writeSnapshots(snapshots);
317113
+ } catch (error) {
317114
+ const message = error instanceof Error ? error.message : String(error);
317115
+ console.warn(`[athena-cli] Failed to compute scan delta: ${message}`);
317116
+ }
317117
+ return report;
317118
+ }
317119
+ function createSnapshot(report, targetKey, projectRoot) {
317120
+ const findings = report.files.flatMap(
317121
+ (file) => file.findings.map((finding) => ({
317122
+ id: finding.id,
317123
+ severity: finding.severity,
317124
+ folder: folderForPath(finding.file, projectRoot)
317125
+ }))
317126
+ );
317127
+ const folderRisk = {};
317128
+ for (const finding of findings) {
317129
+ folderRisk[finding.folder] = (folderRisk[finding.folder] ?? 0) + severityWeights[finding.severity];
317130
+ }
317131
+ return {
317132
+ timestamp: report.timestamp,
317133
+ targetKey,
317134
+ riskScore: findings.reduce((sum, finding) => sum + severityWeights[finding.severity], 0),
317135
+ findings,
317136
+ folderRisk
317137
+ };
317138
+ }
317139
+ function computeDelta(current, previous) {
317140
+ if (!previous) {
317141
+ return {
317142
+ baseline: true,
317143
+ riskScore: {
317144
+ current: current.riskScore,
317145
+ previous: 0,
317146
+ change: current.riskScore
317147
+ },
317148
+ findings: {
317149
+ current: current.findings.length,
317150
+ previous: 0,
317151
+ change: current.findings.length,
317152
+ new: current.findings.length,
317153
+ resolved: 0,
317154
+ newBySeverity: countBySeverity(current.findings),
317155
+ resolvedBySeverity: { ...emptySeverityCounts }
317156
+ },
317157
+ folders: topFolderDeltas(current.folderRisk, {}),
317158
+ regressionAlert: false
317159
+ };
317160
+ }
317161
+ const previousById = new Map(previous.findings.map((finding) => [finding.id, finding]));
317162
+ const currentById = new Map(current.findings.map((finding) => [finding.id, finding]));
317163
+ const newFindings = current.findings.filter((finding) => !previousById.has(finding.id));
317164
+ const resolvedFindings = previous.findings.filter((finding) => !currentById.has(finding.id));
317165
+ const riskChange = current.riskScore - previous.riskScore;
317166
+ return {
317167
+ baseline: false,
317168
+ previousTimestamp: previous.timestamp,
317169
+ riskScore: {
317170
+ current: current.riskScore,
317171
+ previous: previous.riskScore,
317172
+ change: riskChange
317173
+ },
317174
+ findings: {
317175
+ current: current.findings.length,
317176
+ previous: previous.findings.length,
317177
+ change: current.findings.length - previous.findings.length,
317178
+ new: newFindings.length,
317179
+ resolved: resolvedFindings.length,
317180
+ newBySeverity: countBySeverity(newFindings),
317181
+ resolvedBySeverity: countBySeverity(resolvedFindings)
317182
+ },
317183
+ folders: topFolderDeltas(current.folderRisk, previous.folderRisk),
317184
+ regressionAlert: riskChange >= 5 || countBySeverity(newFindings).CRITICAL > 0
317185
+ };
317186
+ }
317187
+ function countBySeverity(findings) {
317188
+ return findings.reduce(
317189
+ (counts, finding) => {
317190
+ counts[finding.severity] += 1;
317191
+ return counts;
317192
+ },
317193
+ { ...emptySeverityCounts }
317194
+ );
317195
+ }
317196
+ function topFolderDeltas(current, previous) {
317197
+ const folders = /* @__PURE__ */ new Set([...Object.keys(current), ...Object.keys(previous)]);
317198
+ return Array.from(folders).map((folder) => {
317199
+ const currentRisk = current[folder] ?? 0;
317200
+ const previousRisk = previous[folder] ?? 0;
317201
+ return {
317202
+ folder,
317203
+ currentRisk,
317204
+ previousRisk,
317205
+ change: currentRisk - previousRisk
317206
+ };
317207
+ }).filter((folder) => folder.change !== 0).sort((a2, b) => Math.abs(b.change) - Math.abs(a2.change)).slice(0, 3);
317208
+ }
317209
+ async function readSnapshots() {
317210
+ try {
317211
+ return JSON.parse(await (0, import_promises5.readFile)(SNAPSHOT_PATH, "utf8"));
317212
+ } catch {
317213
+ return {};
317214
+ }
317215
+ }
317216
+ async function writeSnapshots(snapshots) {
317217
+ await (0, import_promises5.mkdir)(ATHENA_DIR, { recursive: true });
317218
+ await (0, import_promises5.writeFile)(SNAPSHOT_PATH, `${JSON.stringify(snapshots, null, 2)}
317219
+ `, "utf8");
317220
+ }
317221
+ function folderForPath(filePath, projectRoot) {
317222
+ const path2 = ((0, import_node_path7.isAbsolute)(filePath) ? (0, import_node_path7.relative)(projectRoot, filePath) : filePath).split("\\").join("/");
317223
+ const folder = (0, import_node_path7.dirname)(path2).split("\\").join("/");
317224
+ return folder === "." ? "<root>" : folder.split("/")[0] ?? "<root>";
317225
+ }
317016
317226
 
317017
317227
  // src/utils/file-filter.ts
317018
- var import_promises4 = require("fs/promises");
317019
- var import_node_path6 = require("path");
317228
+ var import_promises6 = require("fs/promises");
317229
+ var import_node_path8 = require("path");
317020
317230
  var supported = /* @__PURE__ */ new Set([".js", ".jsx", ".ts", ".tsx"]);
317021
317231
  var ignoredDirs = /* @__PURE__ */ new Set([
317022
317232
  "node_modules",
@@ -317041,23 +317251,41 @@ var ignoredDirs = /* @__PURE__ */ new Set([
317041
317251
  function isSourceFile(filePath) {
317042
317252
  return [...supported].some((ext) => filePath.endsWith(ext));
317043
317253
  }
317044
- async function findSourceFiles(root) {
317045
- const rootStat = await (0, import_promises4.stat)(root).catch(() => null);
317254
+ function isExcludedPath(filePath, root, excludes = []) {
317255
+ if (excludes.length === 0) return false;
317256
+ const normalizedRelativePath = (0, import_node_path8.relative)(root, filePath).split("\\").join("/");
317257
+ const relativeSegments = normalizedRelativePath.split("/").filter(Boolean);
317258
+ return excludes.some((pattern) => {
317259
+ const normalizedPattern = pattern.replace(/^\.\//, "").replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");
317260
+ if (!normalizedPattern) return false;
317261
+ const patternSegments = normalizedPattern.split("/").filter(Boolean);
317262
+ if (patternSegments.length === 1) {
317263
+ return relativeSegments.includes(patternSegments[0]);
317264
+ }
317265
+ return normalizedRelativePath === normalizedPattern || normalizedRelativePath.startsWith(`${normalizedPattern}/`) || normalizedRelativePath.includes(`/${normalizedPattern}/`);
317266
+ });
317267
+ }
317268
+ async function findSourceFiles(root, excludes = []) {
317269
+ const rootStat = await (0, import_promises6.stat)(root).catch(() => null);
317046
317270
  if (!rootStat) return [];
317047
- if (rootStat.isFile()) return isSourceFile(root) ? [root] : [];
317271
+ if (rootStat.isFile()) return isSourceFile(root) && !isExcludedPath(root, root, excludes) ? [root] : [];
317048
317272
  const output = [];
317049
- await walk(root, output);
317273
+ await walk(root, root, output, excludes);
317050
317274
  return output;
317051
317275
  }
317052
- async function walk(dir, output) {
317053
- const entries = await (0, import_promises4.readdir)(dir, { withFileTypes: true }).catch(() => []);
317276
+ async function walk(dir, root, output, excludes) {
317277
+ const entries = await (0, import_promises6.readdir)(dir, { withFileTypes: true }).catch(() => []);
317054
317278
  for (const entry of entries) {
317279
+ const fullPath = (0, import_node_path8.join)(dir, entry.name);
317055
317280
  if (entry.isDirectory()) {
317056
- if (!ignoredDirs.has(entry.name)) await walk((0, import_node_path6.join)(dir, entry.name), output);
317281
+ if (!ignoredDirs.has(entry.name) && !isExcludedPath(fullPath, root, excludes)) {
317282
+ await walk(fullPath, root, output, excludes);
317283
+ }
317057
317284
  continue;
317058
317285
  }
317059
- const filePath = (0, import_node_path6.join)(dir, entry.name);
317060
- if (entry.isFile() && isSourceFile(filePath)) output.push(filePath);
317286
+ if (entry.isFile() && isSourceFile(fullPath) && !isExcludedPath(fullPath, root, excludes)) {
317287
+ output.push(fullPath);
317288
+ }
317061
317289
  }
317062
317290
  }
317063
317291
 
@@ -317098,11 +317326,11 @@ async function getStagedFiles() {
317098
317326
  }
317099
317327
 
317100
317328
  // src/utils/history.ts
317101
- var import_promises5 = require("fs/promises");
317102
- var import_node_os = require("os");
317103
- var import_node_path7 = require("path");
317104
- var ATHENA_DIR = (0, import_node_path7.join)((0, import_node_os.homedir)(), ".athena");
317105
- var HISTORY_PATH = (0, import_node_path7.join)(ATHENA_DIR, "scan-history.jsonl");
317329
+ var import_promises7 = require("fs/promises");
317330
+ var import_node_os2 = require("os");
317331
+ var import_node_path9 = require("path");
317332
+ var ATHENA_DIR2 = (0, import_node_path9.join)((0, import_node_os2.homedir)(), ".athena");
317333
+ var HISTORY_PATH = (0, import_node_path9.join)(ATHENA_DIR2, "scan-history.jsonl");
317106
317334
  var MAX_HISTORY_LINES = 300;
317107
317335
  function logHistoryWarning(context, error) {
317108
317336
  const message = error instanceof Error ? error.message : String(error);
@@ -317110,17 +317338,17 @@ function logHistoryWarning(context, error) {
317110
317338
  }
317111
317339
  async function appendScanHistory(entry) {
317112
317340
  try {
317113
- await (0, import_promises5.mkdir)(ATHENA_DIR, { recursive: true });
317341
+ await (0, import_promises7.mkdir)(ATHENA_DIR2, { recursive: true });
317114
317342
  let lines = [];
317115
317343
  try {
317116
- const existing = await (0, import_promises5.readFile)(HISTORY_PATH, "utf8");
317344
+ const existing = await (0, import_promises7.readFile)(HISTORY_PATH, "utf8");
317117
317345
  lines = existing.split("\n").map((line) => line.trim()).filter(Boolean);
317118
317346
  } catch (error) {
317119
317347
  logHistoryWarning("History file not readable, starting new history", error);
317120
317348
  }
317121
317349
  lines.push(JSON.stringify(entry));
317122
317350
  const trimmed = lines.slice(-MAX_HISTORY_LINES);
317123
- await (0, import_promises5.writeFile)(HISTORY_PATH, `${trimmed.join("\n")}
317351
+ await (0, import_promises7.writeFile)(HISTORY_PATH, `${trimmed.join("\n")}
317124
317352
  `, "utf8");
317125
317353
  } catch (error) {
317126
317354
  logHistoryWarning("Failed to persist scan history", error);
@@ -317128,7 +317356,7 @@ async function appendScanHistory(entry) {
317128
317356
  }
317129
317357
  async function getRecentScanHistory(limit = 3) {
317130
317358
  try {
317131
- const content = await (0, import_promises5.readFile)(HISTORY_PATH, "utf8");
317359
+ const content = await (0, import_promises7.readFile)(HISTORY_PATH, "utf8");
317132
317360
  const lines = content.split("\n").map((line) => line.trim()).filter(Boolean).slice(-Math.max(1, limit));
317133
317361
  return lines.map((line) => {
317134
317362
  try {
@@ -317161,7 +317389,7 @@ function formatRecentHistory(entries) {
317161
317389
  }
317162
317390
 
317163
317391
  // src/utils/scan-progress.ts
317164
- var import_node_path8 = require("path");
317392
+ var import_node_path10 = require("path");
317165
317393
 
317166
317394
  // src/utils/colors.ts
317167
317395
  var c3 = {
@@ -317247,7 +317475,7 @@ function createScanProgressRenderer(enabled) {
317247
317475
  return {
317248
317476
  onProgress: (event) => {
317249
317477
  total = event.total;
317250
- currentFile = (0, import_node_path8.basename)(event.filePath);
317478
+ currentFile = (0, import_node_path10.basename)(event.filePath);
317251
317479
  if (event.status === "scanned" || event.status === "skipped" || event.status === "missing") {
317252
317480
  processed = event.index;
317253
317481
  }
@@ -317288,44 +317516,67 @@ function printRunResult(blocked) {
317288
317516
  }
317289
317517
  console.log("");
317290
317518
  }
317519
+ function printScannerNotes(messages) {
317520
+ const unique = dedupeMessages(messages);
317521
+ if (unique.length === 0) return;
317522
+ console.log(` ${c3.bold}Scanner Notes${c3.reset}`);
317523
+ for (const message of unique) {
317524
+ const marker = message.level === "warn" ? `${c3.yellow}!${c3.reset}` : `${c3.gray}-${c3.reset}`;
317525
+ console.log(` ${marker} ${c3.dim}${truncate(message.text, Math.min(process.stdout.columns ?? 100, 110) - 6)}${c3.reset}`);
317526
+ }
317527
+ console.log("");
317528
+ }
317529
+ function dedupeMessages(messages) {
317530
+ const seen = /* @__PURE__ */ new Set();
317531
+ const result = [];
317532
+ for (const message of messages) {
317533
+ const key = `${message.level}:${message.text}`;
317534
+ if (seen.has(key)) continue;
317535
+ seen.add(key);
317536
+ result.push(message);
317537
+ }
317538
+ return result;
317539
+ }
317291
317540
 
317292
317541
  // src/commands/check.ts
317293
317542
  async function checkCommand(files, options) {
317543
+ const config = mergeConfig({
317544
+ threshold: Number(options.threshold)
317545
+ });
317546
+ config.eslint = { ...config.eslint, enabled: options.eslint !== false };
317547
+ config.npmAudit = { ...config.npmAudit, enabled: options.npmAudit !== false };
317548
+ config.nodejsscan = { ...config.nodejsscan, enabled: options.nodejsscan !== false };
317549
+ config.bearer = { ...config.bearer, enabled: options.bearer !== false };
317550
+ config.semgrep.enabled = options.semgrep !== false;
317294
317551
  const selected = files.length > 0 ? files : await getStagedFiles();
317295
- const sourceFiles = selected.filter(isSourceFile).map((file) => (0, import_node_path9.resolve)(process.cwd(), file));
317552
+ const sourceFiles = selected.filter(isSourceFile).map((file) => (0, import_node_path11.resolve)(process.cwd(), file)).filter((file) => !isExcludedPath(file, process.cwd(), config.exclude));
317296
317553
  if (!options.quietHeader) {
317297
317554
  if (process.stdout.isTTY) {
317298
317555
  clearScreen();
317299
317556
  }
317300
317557
  printRunHeader("check", `${sourceFiles.length} staged/source files`);
317301
317558
  }
317302
- const expanded = sourceFiles.length === 1 ? await findSourceFiles(sourceFiles[0]) : sourceFiles;
317559
+ const expanded = sourceFiles.length === 1 ? await findSourceFiles(sourceFiles[0], config.exclude) : sourceFiles;
317303
317560
  const maxFindings = parseMaxFindings(options.maxFindings);
317304
317561
  const progress = createScanProgressRenderer(options.format === "terminal");
317305
- const scannerConfig = {
317306
- threshold: Number(options.threshold),
317307
- eslint: { enabled: options.eslint !== false },
317308
- npmAudit: { enabled: options.npmAudit !== false },
317309
- nodejsscan: { enabled: options.nodejsscan !== false },
317310
- bearer: { enabled: options.bearer !== false },
317311
- semgrep: { enabled: options.semgrep !== false }
317312
- };
317313
- const report = await (async () => {
317562
+ const { result: report, messages } = await withBufferedAthenaCoreConsole(async () => {
317314
317563
  try {
317315
317564
  return await scanFiles(
317316
317565
  expanded,
317317
- scannerConfig,
317566
+ config,
317318
317567
  { onFileProgress: progress.onProgress }
317319
317568
  );
317320
317569
  } finally {
317321
317570
  progress.stop();
317322
317571
  }
317323
- })();
317572
+ });
317573
+ await attachScanDelta(report, `check:${process.cwd()}`, process.cwd());
317324
317574
  if (options.format === "json") {
317325
317575
  console.log(JSON.stringify(report, null, 2));
317326
317576
  } else if (options.format === "jsonl") {
317327
317577
  console.log(formatJsonl(report));
317328
317578
  } else {
317579
+ printScannerNotes(messages);
317329
317580
  console.log(formatTerminalReport(report, { maxFindings }));
317330
317581
  }
317331
317582
  await appendScanHistory({
@@ -317371,8 +317622,8 @@ async function doctorCommand() {
317371
317622
  console.log(`
317372
317623
  ${c3.yellow}tip:${c3.reset} install Semgrep with ${c3.bold}athena setup semgrep${c3.reset}`);
317373
317624
  }
317374
- const eslint2 = statuses.find((item) => item.name === "eslint");
317375
- if (!eslint2?.ok) {
317625
+ const eslint = statuses.find((item) => item.name === "eslint");
317626
+ if (!eslint?.ok) {
317376
317627
  console.log(` ${c3.yellow}tip:${c3.reset} install ESLint with ${c3.bold}npm install --save-dev eslint eslint-plugin-security${c3.reset}`);
317377
317628
  }
317378
317629
  const docker = statuses.find((item) => item.name === "docker");
@@ -317407,8 +317658,8 @@ ${stderr}`.trim();
317407
317658
  }
317408
317659
 
317409
317660
  // src/commands/init.ts
317410
- var import_promises6 = require("fs/promises");
317411
- var import_node_path10 = require("path");
317661
+ var import_promises8 = require("fs/promises");
317662
+ var import_node_path12 = require("path");
317412
317663
  async function initCommand() {
317413
317664
  const root = await getGitRoot();
317414
317665
  const hooksDir = await getGitHooksDir();
@@ -317417,14 +317668,14 @@ async function initCommand() {
317417
317668
  process.exitCode = 1;
317418
317669
  return;
317419
317670
  }
317420
- const hookPath = (0, import_node_path10.join)(hooksDir, "pre-commit");
317671
+ const hookPath = (0, import_node_path12.join)(hooksDir, "pre-commit");
317421
317672
  const hook = [
317422
317673
  "#!/bin/sh",
317423
317674
  'echo "athena: checking staged JS/TS files"',
317424
317675
  "npx athena check"
317425
317676
  ].join("\n");
317426
- await (0, import_promises6.mkdir)((0, import_node_path10.dirname)(hookPath), { recursive: true });
317427
- await (0, import_promises6.writeFile)(hookPath, `${hook}
317677
+ await (0, import_promises8.mkdir)((0, import_node_path12.dirname)(hookPath), { recursive: true });
317678
+ await (0, import_promises8.writeFile)(hookPath, `${hook}
317428
317679
  `, { mode: 493 });
317429
317680
  console.log(`Athena pre-commit hook installed at ${hookPath}`);
317430
317681
  }
@@ -317433,42 +317684,44 @@ async function initCommand() {
317433
317684
  var import_node_readline = require("readline");
317434
317685
 
317435
317686
  // src/commands/scan.ts
317436
- var import_node_path11 = require("path");
317687
+ var import_node_path13 = require("path");
317437
317688
  async function scanCommand(dir, options) {
317438
- const root = (0, import_node_path11.resolve)(process.cwd(), dir);
317689
+ const root = (0, import_node_path13.resolve)(process.cwd(), dir);
317690
+ const config = mergeConfig({
317691
+ threshold: Number(options.threshold)
317692
+ });
317693
+ config.eslint = { ...config.eslint, enabled: options.eslint !== false };
317694
+ config.npmAudit = { ...config.npmAudit, enabled: options.npmAudit !== false };
317695
+ config.nodejsscan = { ...config.nodejsscan, enabled: options.nodejsscan !== false };
317696
+ config.bearer = { ...config.bearer, enabled: options.bearer !== false };
317697
+ config.semgrep.enabled = options.semgrep !== false;
317439
317698
  if (!options.quietHeader) {
317440
317699
  if (process.stdout.isTTY) {
317441
317700
  clearScreen();
317442
317701
  }
317443
317702
  printRunHeader("scan", root);
317444
317703
  }
317445
- const files = await findSourceFiles(root);
317704
+ const files = await findSourceFiles(root, config.exclude);
317446
317705
  const maxFindings = parseMaxFindings2(options.maxFindings);
317447
317706
  const progress = createScanProgressRenderer(options.format === "terminal");
317448
- const scannerConfig = {
317449
- threshold: Number(options.threshold),
317450
- eslint: { enabled: options - eslint !== false },
317451
- npmAudit: { enabled: options.npmAudit !== false },
317452
- nodejsscan: { enabled: options.nodejsscan !== false },
317453
- bearer: { enabled: options.bearer !== false },
317454
- semgrep: { enabled: options.semgrep !== false }
317455
- };
317456
- const report = await (async () => {
317707
+ const { result: report, messages } = await withBufferedAthenaCoreConsole(async () => {
317457
317708
  try {
317458
317709
  return await scanFiles(
317459
317710
  files,
317460
- scannerConfig,
317711
+ config,
317461
317712
  { onFileProgress: progress.onProgress }
317462
317713
  );
317463
317714
  } finally {
317464
317715
  progress.stop();
317465
317716
  }
317466
- })();
317717
+ });
317718
+ await attachScanDelta(report, `scan:${root}`, root);
317467
317719
  if (options.format === "json") {
317468
317720
  console.log(JSON.stringify(report, null, 2));
317469
317721
  } else if (options.format === "jsonl") {
317470
317722
  console.log(formatJsonl(report));
317471
317723
  } else {
317724
+ printScannerNotes(messages);
317472
317725
  console.log(formatTerminalReport(report, { maxFindings }));
317473
317726
  }
317474
317727
  await appendScanHistory({
@@ -317518,10 +317771,81 @@ async function setupSemgrepCommand(options = {}) {
317518
317771
  process.exitCode = 1;
317519
317772
  }
317520
317773
  }
317774
+ function getSetupAllPlan(platform) {
317775
+ return [
317776
+ {
317777
+ name: "ESLint + eslint-plugin-security",
317778
+ includedWithAthena: true,
317779
+ note: "Bundled as Athena optional dependencies and used by the ESLint scanner when present."
317780
+ },
317781
+ {
317782
+ name: "npm audit",
317783
+ includedWithAthena: true,
317784
+ note: "Uses npm CLI that ships with Node.js. No separate scanner package install required."
317785
+ },
317786
+ {
317787
+ name: "Semgrep",
317788
+ includedWithAthena: false,
317789
+ autoInstallCommand: getSemgrepInstallCommand(platform),
317790
+ manualInstallCommand: getSemgrepInstallCommand(platform),
317791
+ note: "External binary scanner. Optional, but improves SAST coverage."
317792
+ },
317793
+ {
317794
+ name: "Docker (for nodejsscan)",
317795
+ includedWithAthena: false,
317796
+ note: "Required runtime for nodejsscan container execution; install from Docker Desktop/package manager."
317797
+ },
317798
+ {
317799
+ name: "Bearer CLI",
317800
+ includedWithAthena: false,
317801
+ autoInstallCommand: "npm install -g @bearer/cli",
317802
+ manualInstallCommand: "npm install -g @bearer/cli",
317803
+ note: "External CLI scanner for privacy and data-flow analysis."
317804
+ }
317805
+ ];
317806
+ }
317807
+ async function setupAllCommand(options = {}) {
317808
+ const plan = getSetupAllPlan(process.platform);
317809
+ console.log("Athena scanner setup plan\n");
317810
+ for (const tool of plan) {
317811
+ const inclusion = tool.includedWithAthena ? "included" : "external";
317812
+ console.log(`- ${tool.name} (${inclusion})`);
317813
+ console.log(` ${tool.note}`);
317814
+ if (tool.manualInstallCommand && !tool.includedWithAthena) {
317815
+ console.log(` install: ${tool.manualInstallCommand}`);
317816
+ }
317817
+ }
317818
+ if (!options.auto) {
317819
+ console.log("\nUse --auto to run supported install commands automatically.");
317820
+ return;
317821
+ }
317822
+ let failed = false;
317823
+ for (const tool of plan) {
317824
+ if (!tool.autoInstallCommand) continue;
317825
+ try {
317826
+ console.log(`
317827
+ Installing ${tool.name}...`);
317828
+ const { stdout, stderr } = await execAsync(tool.autoInstallCommand, { timeout: 18e4, maxBuffer: 1024 * 1024 });
317829
+ if (stdout.trim()) console.log(stdout.trim());
317830
+ if (stderr.trim()) console.log(stderr.trim());
317831
+ console.log(`Completed: ${tool.name}`);
317832
+ } catch (error) {
317833
+ const message = error instanceof Error ? error.message : String(error);
317834
+ console.error(`Failed: ${tool.name} (${message})`);
317835
+ failed = true;
317836
+ }
317837
+ }
317838
+ if (failed) {
317839
+ console.log("\nSome installs failed. You can run their manual commands from the setup plan above.");
317840
+ process.exitCode = 1;
317841
+ return;
317842
+ }
317843
+ console.log("\nSetup complete. Run `athena doctor` to verify tool availability.");
317844
+ }
317521
317845
 
317522
317846
  // src/commands/uninstall.ts
317523
- var import_promises7 = require("fs/promises");
317524
- var import_node_path12 = require("path");
317847
+ var import_promises9 = require("fs/promises");
317848
+ var import_node_path14 = require("path");
317525
317849
  async function uninstallCommand() {
317526
317850
  const root = await getGitRoot();
317527
317851
  const hooksDir = await getGitHooksDir();
@@ -317530,15 +317854,15 @@ async function uninstallCommand() {
317530
317854
  process.exitCode = 1;
317531
317855
  return;
317532
317856
  }
317533
- const hookPath = (0, import_node_path12.join)(hooksDir, "pre-commit");
317534
- await (0, import_promises7.rm)(hookPath, { force: true });
317857
+ const hookPath = (0, import_node_path14.join)(hooksDir, "pre-commit");
317858
+ await (0, import_promises9.rm)(hookPath, { force: true });
317535
317859
  console.log(`Athena pre-commit hook removed from ${hookPath}`);
317536
317860
  }
317537
317861
 
317538
317862
  // package.json
317539
317863
  var package_default = {
317540
317864
  name: "@arsh342/athena",
317541
- version: "0.2.1",
317865
+ version: "0.2.2",
317542
317866
  description: "AI code provenance tracker and terminal scanner for JavaScript and TypeScript repositories.",
317543
317867
  type: "module",
317544
317868
  bin: {
@@ -317583,6 +317907,10 @@ var package_default = {
317583
317907
  publishConfig: {
317584
317908
  access: "public"
317585
317909
  },
317910
+ optionalDependencies: {
317911
+ eslint: "^9.0.0",
317912
+ "eslint-plugin-security": "^3.0.0"
317913
+ },
317586
317914
  devDependencies: {
317587
317915
  "@athena/core": "file:../core",
317588
317916
  commander: "^14.0.0",
@@ -317790,7 +318118,9 @@ program2.command("check").argument("[files...]", "files to check; defaults to st
317790
318118
  program2.command("init").description("install Athena pre-commit hook").action(initCommand);
317791
318119
  program2.command("uninstall").description("remove Athena pre-commit hook").action(uninstallCommand);
317792
318120
  program2.command("doctor").description("check local toolchain health (node, npm, semgrep, trivy)").action(doctorCommand);
317793
- program2.command("setup").description("setup optional external scanners").command("semgrep").option("--auto", "run install command automatically").description("install or print install command for semgrep").action(setupSemgrepCommand);
318121
+ var setupCommand = program2.command("setup").description("setup optional external scanners");
318122
+ setupCommand.command("semgrep").option("--auto", "run install command automatically").description("install or print install command for semgrep").action(setupSemgrepCommand);
318123
+ setupCommand.command("all").option("--auto", "run supported install commands automatically").description("print/setup all scanner dependencies (included + external)").action(setupAllCommand);
317794
318124
  program2.command("menu").description("open interactive terminal selector").action(() => menuCommand(program2));
317795
318125
  async function main() {
317796
318126
  if (process.stdout.isTTY) {