@arsh342/athena 0.4.3 → 0.4.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.
Files changed (3) hide show
  1. package/README.md +9 -1
  2. package/dist/index.cjs +833 -479
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -20661,7 +20661,7 @@ var require_typescript = __commonJS({
20661
20661
  classicNameResolver: () => classicNameResolver,
20662
20662
  classifier: () => ts_classifier_exports,
20663
20663
  cleanExtendedConfigCache: () => cleanExtendedConfigCache,
20664
- clear: () => clear2,
20664
+ clear: () => clear,
20665
20665
  clearMap: () => clearMap,
20666
20666
  clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
20667
20667
  climbPastPropertyAccess: () => climbPastPropertyAccess,
@@ -22658,7 +22658,7 @@ var require_typescript = __commonJS({
22658
22658
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
22659
22659
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
22660
22660
  writeCommentRange: () => writeCommentRange,
22661
- writeFile: () => writeFile9,
22661
+ writeFile: () => writeFile10,
22662
22662
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
22663
22663
  zipWith: () => zipWith
22664
22664
  });
@@ -22857,7 +22857,7 @@ var require_typescript = __commonJS({
22857
22857
  }
22858
22858
  array.length = outIndex;
22859
22859
  }
22860
- function clear2(array) {
22860
+ function clear(array) {
22861
22861
  array.length = 0;
22862
22862
  }
22863
22863
  function map(array, f) {
@@ -28990,7 +28990,7 @@ ${lanes.join("\n")}
28990
28990
  writeOutputIsTTY() {
28991
28991
  return process.stdout.isTTY;
28992
28992
  },
28993
- readFile: readFile17,
28993
+ readFile: readFile18,
28994
28994
  writeFile: writeFile22,
28995
28995
  watchFile: watchFile2,
28996
28996
  watchDirectory,
@@ -29196,7 +29196,7 @@ ${lanes.join("\n")}
29196
29196
  callback
29197
29197
  );
29198
29198
  }
29199
- function readFile17(fileName, _encoding) {
29199
+ function readFile18(fileName, _encoding) {
29200
29200
  let buffer;
29201
29201
  try {
29202
29202
  buffer = _fs.readFileSync(fileName);
@@ -41301,7 +41301,7 @@ ${lanes.join("\n")}
41301
41301
  sourceFilePath = isSourceFileInCommonSourceDirectory ? sourceFilePath.substring(commonSourceDirectory.length) : sourceFilePath;
41302
41302
  return combinePaths(newDirPath, sourceFilePath);
41303
41303
  }
41304
- function writeFile9(host, diagnostics, fileName, text2, writeByteOrderMark, sourceFiles, data) {
41304
+ function writeFile10(host, diagnostics, fileName, text2, writeByteOrderMark, sourceFiles, data) {
41305
41305
  host.writeFile(
41306
41306
  fileName,
41307
41307
  text2,
@@ -65752,7 +65752,7 @@ ${lanes.join("\n")}
65752
65752
  const possibleOption = getSpellingSuggestion(unknownOption, diagnostics.optionDeclarations, getOptionName);
65753
65753
  return possibleOption ? createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownDidYouMeanDiagnostic, unknownOptionErrorText || unknownOption, possibleOption.name) : createDiagnosticForNodeInSourceFileOrCompilerDiagnostic(sourceFile, node, diagnostics.unknownOptionDiagnostic, unknownOptionErrorText || unknownOption);
65754
65754
  }
65755
- function parseCommandLineWorker(diagnostics, commandLine, readFile17) {
65755
+ function parseCommandLineWorker(diagnostics, commandLine, readFile18) {
65756
65756
  const options = {};
65757
65757
  let watchOptions;
65758
65758
  const fileNames = [];
@@ -65800,7 +65800,7 @@ ${lanes.join("\n")}
65800
65800
  }
65801
65801
  }
65802
65802
  function parseResponseFile(fileName) {
65803
- const text2 = tryReadFile(fileName, readFile17 || ((fileName2) => sys.readFile(fileName2)));
65803
+ const text2 = tryReadFile(fileName, readFile18 || ((fileName2) => sys.readFile(fileName2)));
65804
65804
  if (!isString(text2)) {
65805
65805
  errors.push(text2);
65806
65806
  return;
@@ -65903,8 +65903,8 @@ ${lanes.join("\n")}
65903
65903
  unknownDidYouMeanDiagnostic: Diagnostics.Unknown_compiler_option_0_Did_you_mean_1,
65904
65904
  optionTypeMismatchDiagnostic: Diagnostics.Compiler_option_0_expects_an_argument
65905
65905
  };
65906
- function parseCommandLine(commandLine, readFile17) {
65907
- return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile17);
65906
+ function parseCommandLine(commandLine, readFile18) {
65907
+ return parseCommandLineWorker(compilerOptionsDidYouMeanDiagnostics, commandLine, readFile18);
65908
65908
  }
65909
65909
  function getOptionFromName(optionName, allowShort) {
65910
65910
  return getOptionDeclarationFromName(getOptionsNameMap, optionName, allowShort);
@@ -65986,8 +65986,8 @@ ${lanes.join("\n")}
65986
65986
  watchOptionsToExtend
65987
65987
  );
65988
65988
  }
65989
- function readConfigFile(fileName, readFile17) {
65990
- const textOrDiagnostic = tryReadFile(fileName, readFile17);
65989
+ function readConfigFile(fileName, readFile18) {
65990
+ const textOrDiagnostic = tryReadFile(fileName, readFile18);
65991
65991
  return isString(textOrDiagnostic) ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic };
65992
65992
  }
65993
65993
  function parseConfigFileTextToJson(fileName, jsonText) {
@@ -66002,14 +66002,14 @@ ${lanes.join("\n")}
66002
66002
  error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : void 0
66003
66003
  };
66004
66004
  }
66005
- function readJsonConfigFile(fileName, readFile17) {
66006
- const textOrDiagnostic = tryReadFile(fileName, readFile17);
66005
+ function readJsonConfigFile(fileName, readFile18) {
66006
+ const textOrDiagnostic = tryReadFile(fileName, readFile18);
66007
66007
  return isString(textOrDiagnostic) ? parseJsonText(fileName, textOrDiagnostic) : { fileName, parseDiagnostics: [textOrDiagnostic] };
66008
66008
  }
66009
- function tryReadFile(fileName, readFile17) {
66009
+ function tryReadFile(fileName, readFile18) {
66010
66010
  let text2;
66011
66011
  try {
66012
- text2 = readFile17(fileName);
66012
+ text2 = readFile18(fileName);
66013
66013
  } catch (e) {
66014
66014
  return createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message);
66015
66015
  }
@@ -68138,7 +68138,7 @@ ${lanes.join("\n")}
68138
68138
  getMapOfCacheRedirects,
68139
68139
  getOrCreateMapOfCacheRedirects,
68140
68140
  update,
68141
- clear: clear22,
68141
+ clear: clear2,
68142
68142
  getOwnMap: () => ownMap
68143
68143
  };
68144
68144
  function getMapOfCacheRedirects(redirectedReference) {
@@ -68183,7 +68183,7 @@ ${lanes.join("\n")}
68183
68183
  if (result) redirectsMap.set(redirectOptions, result);
68184
68184
  return result;
68185
68185
  }
68186
- function clear22() {
68186
+ function clear2() {
68187
68187
  const ownKey = ownOptions && optionsToRedirectsKey.get(ownOptions);
68188
68188
  ownMap.clear();
68189
68189
  redirectsMap.clear();
@@ -68204,14 +68204,14 @@ ${lanes.join("\n")}
68204
68204
  }
68205
68205
  function createPackageJsonInfoCache(currentDirectory, getCanonicalFileName) {
68206
68206
  let cache3;
68207
- return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear22, getInternalMap };
68207
+ return { getPackageJsonInfo: getPackageJsonInfo2, setPackageJsonInfo, clear: clear2, getInternalMap };
68208
68208
  function getPackageJsonInfo2(packageJsonPath) {
68209
68209
  return cache3 == null ? void 0 : cache3.get(toPath(packageJsonPath, currentDirectory, getCanonicalFileName));
68210
68210
  }
68211
68211
  function setPackageJsonInfo(packageJsonPath, info) {
68212
68212
  (cache3 || (cache3 = /* @__PURE__ */ new Map())).set(toPath(packageJsonPath, currentDirectory, getCanonicalFileName), info);
68213
68213
  }
68214
- function clear22() {
68214
+ function clear2() {
68215
68215
  cache3 = void 0;
68216
68216
  }
68217
68217
  function getInternalMap() {
@@ -68232,11 +68232,11 @@ ${lanes.join("\n")}
68232
68232
  return {
68233
68233
  getFromDirectoryCache,
68234
68234
  getOrCreateCacheForDirectory,
68235
- clear: clear22,
68235
+ clear: clear2,
68236
68236
  update,
68237
68237
  directoryToModuleNameMap
68238
68238
  };
68239
- function clear22() {
68239
+ function clear2() {
68240
68240
  directoryToModuleNameMap.clear();
68241
68241
  }
68242
68242
  function update(options2) {
@@ -68301,10 +68301,10 @@ ${lanes.join("\n")}
68301
68301
  return {
68302
68302
  getFromNonRelativeNameCache,
68303
68303
  getOrCreateCacheForNonRelativeName,
68304
- clear: clear22,
68304
+ clear: clear2,
68305
68305
  update
68306
68306
  };
68307
- function clear22() {
68307
+ function clear2() {
68308
68308
  moduleNameToDirectoryMap.clear();
68309
68309
  }
68310
68310
  function update(options2) {
@@ -68385,13 +68385,13 @@ ${lanes.join("\n")}
68385
68385
  ...packageJsonInfoCache,
68386
68386
  ...perDirectoryResolutionCache,
68387
68387
  ...nonRelativeNameResolutionCache,
68388
- clear: clear22,
68388
+ clear: clear2,
68389
68389
  update,
68390
68390
  getPackageJsonInfoCache: () => packageJsonInfoCache,
68391
68391
  clearAllExceptPackageJsonInfoCache,
68392
68392
  optionsToRedirectsKey
68393
68393
  };
68394
- function clear22() {
68394
+ function clear2() {
68395
68395
  clearAllExceptPackageJsonInfoCache();
68396
68396
  packageJsonInfoCache.clear();
68397
68397
  }
@@ -73666,8 +73666,8 @@ ${lanes.join("\n")}
73666
73666
  visitType(type);
73667
73667
  return { visitedTypes: getOwnValues(visitedTypes), visitedSymbols: getOwnValues(visitedSymbols) };
73668
73668
  } finally {
73669
- clear2(visitedTypes);
73670
- clear2(visitedSymbols);
73669
+ clear(visitedTypes);
73670
+ clear(visitedSymbols);
73671
73671
  }
73672
73672
  },
73673
73673
  walkSymbol: (symbol) => {
@@ -73675,8 +73675,8 @@ ${lanes.join("\n")}
73675
73675
  visitSymbol(symbol);
73676
73676
  return { visitedTypes: getOwnValues(visitedTypes), visitedSymbols: getOwnValues(visitedSymbols) };
73677
73677
  } finally {
73678
- clear2(visitedTypes);
73679
- clear2(visitedSymbols);
73678
+ clear(visitedTypes);
73679
+ clear(visitedSymbols);
73680
73680
  }
73681
73681
  }
73682
73682
  };
@@ -118301,11 +118301,11 @@ ${lanes.join("\n")}
118301
118301
  return;
118302
118302
  }
118303
118303
  checkGrammarSourceFile(node);
118304
- clear2(potentialThisCollisions);
118305
- clear2(potentialNewTargetCollisions);
118306
- clear2(potentialWeakMapSetCollisions);
118307
- clear2(potentialReflectCollisions);
118308
- clear2(potentialUnusedRenamedBindingElementsInTypes);
118304
+ clear(potentialThisCollisions);
118305
+ clear(potentialNewTargetCollisions);
118306
+ clear(potentialWeakMapSetCollisions);
118307
+ clear(potentialReflectCollisions);
118308
+ clear(potentialUnusedRenamedBindingElementsInTypes);
118309
118309
  if (links.flags & 8388608) {
118310
118310
  potentialThisCollisions = links.potentialThisCollisions;
118311
118311
  potentialNewTargetCollisions = links.potentialNewTargetCollisions;
@@ -118336,19 +118336,19 @@ ${lanes.join("\n")}
118336
118336
  }
118337
118337
  if (potentialThisCollisions.length) {
118338
118338
  forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope);
118339
- clear2(potentialThisCollisions);
118339
+ clear(potentialThisCollisions);
118340
118340
  }
118341
118341
  if (potentialNewTargetCollisions.length) {
118342
118342
  forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope);
118343
- clear2(potentialNewTargetCollisions);
118343
+ clear(potentialNewTargetCollisions);
118344
118344
  }
118345
118345
  if (potentialWeakMapSetCollisions.length) {
118346
118346
  forEach(potentialWeakMapSetCollisions, checkWeakMapSetCollision);
118347
- clear2(potentialWeakMapSetCollisions);
118347
+ clear(potentialWeakMapSetCollisions);
118348
118348
  }
118349
118349
  if (potentialReflectCollisions.length) {
118350
118350
  forEach(potentialReflectCollisions, checkReflectCollision);
118351
- clear2(potentialReflectCollisions);
118351
+ clear(potentialReflectCollisions);
118352
118352
  }
118353
118353
  links.flags |= 1;
118354
118354
  }
@@ -118360,11 +118360,11 @@ ${lanes.join("\n")}
118360
118360
  return;
118361
118361
  }
118362
118362
  checkGrammarSourceFile(file4);
118363
- clear2(potentialThisCollisions);
118364
- clear2(potentialNewTargetCollisions);
118365
- clear2(potentialWeakMapSetCollisions);
118366
- clear2(potentialReflectCollisions);
118367
- clear2(potentialUnusedRenamedBindingElementsInTypes);
118363
+ clear(potentialThisCollisions);
118364
+ clear(potentialNewTargetCollisions);
118365
+ clear(potentialWeakMapSetCollisions);
118366
+ clear(potentialReflectCollisions);
118367
+ clear(potentialUnusedRenamedBindingElementsInTypes);
118368
118368
  forEach(nodes, checkSourceElement);
118369
118369
  checkDeferredNodes(file4);
118370
118370
  (links.potentialThisCollisions || (links.potentialThisCollisions = [])).push(...potentialThisCollisions);
@@ -150052,7 +150052,7 @@ ${lanes.join("\n")}
150052
150052
  return;
150053
150053
  }
150054
150054
  const buildInfo = host.getBuildInfo() || { version };
150055
- writeFile9(
150055
+ writeFile10(
150056
150056
  host,
150057
150057
  emitterDiagnostics,
150058
150058
  buildInfoPath,
@@ -150264,7 +150264,7 @@ ${lanes.join("\n")}
150264
150264
  }
150265
150265
  if (sourceMapFilePath) {
150266
150266
  const sourceMap = sourceMapGenerator.toString();
150267
- writeFile9(
150267
+ writeFile10(
150268
150268
  host,
150269
150269
  emitterDiagnostics,
150270
150270
  sourceMapFilePath,
@@ -150279,7 +150279,7 @@ ${lanes.join("\n")}
150279
150279
  }
150280
150280
  const text2 = writer.getText();
150281
150281
  const data = { sourceMapUrlPos, diagnostics: transform2.diagnostics };
150282
- writeFile9(host, emitterDiagnostics, jsFilePath, text2, !!compilerOptions.emitBOM, sourceFiles, data);
150282
+ writeFile10(host, emitterDiagnostics, jsFilePath, text2, !!compilerOptions.emitBOM, sourceFiles, data);
150283
150283
  writer.clear();
150284
150284
  return !data.skippedDtsWrite;
150285
150285
  }
@@ -155667,12 +155667,12 @@ ${lanes.join("\n")}
155667
155667
  function createCompilerHost(options, setParentNodes) {
155668
155668
  return createCompilerHostWorker(options, setParentNodes);
155669
155669
  }
155670
- function createGetSourceFile(readFile17, setParentNodes) {
155670
+ function createGetSourceFile(readFile18, setParentNodes) {
155671
155671
  return (fileName, languageVersionOrOptions, onError) => {
155672
155672
  let text2;
155673
155673
  try {
155674
155674
  mark("beforeIORead");
155675
- text2 = readFile17(fileName);
155675
+ text2 = readFile18(fileName);
155676
155676
  mark("afterIORead");
155677
155677
  measure("I/O Read", "beforeIORead", "afterIORead");
155678
155678
  } catch (e) {
@@ -156576,7 +156576,7 @@ ${lanes.join("\n")}
156576
156576
  getRedirectFromOutput,
156577
156577
  forEachResolvedProjectReference: forEachResolvedProjectReference2
156578
156578
  });
156579
- const readFile17 = host.readFile.bind(host);
156579
+ const readFile18 = host.readFile.bind(host);
156580
156580
  (_e = tracing) == null ? void 0 : _e.push(tracing.Phase.Program, "shouldProgramCreateNewSourceFiles", { hasOldProgram: !!oldProgram });
156581
156581
  const shouldCreateNewSourceFile = shouldProgramCreateNewSourceFiles(oldProgram, options);
156582
156582
  (_f = tracing) == null ? void 0 : _f.pop();
@@ -156802,7 +156802,7 @@ ${lanes.join("\n")}
156802
156802
  shouldTransformImportCall,
156803
156803
  emitBuildInfo,
156804
156804
  fileExists,
156805
- readFile: readFile17,
156805
+ readFile: readFile18,
156806
156806
  directoryExists,
156807
156807
  getSymlinkCache,
156808
156808
  realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
@@ -162066,10 +162066,10 @@ ${lanes.join("\n")}
162066
162066
  isFileWithInvalidatedNonRelativeUnresolvedImports,
162067
162067
  updateTypeRootsWatch,
162068
162068
  closeTypeRootsWatch,
162069
- clear: clear22,
162069
+ clear: clear2,
162070
162070
  onChangesAffectModuleResolution
162071
162071
  };
162072
- function clear22() {
162072
+ function clear2() {
162073
162073
  clearMap(directoryWatchesOfFailedLookups, closeFileWatcherOf);
162074
162074
  clearMap(fileWatchesOfAffectingLocations, closeFileWatcherOf);
162075
162075
  isSymlinkCache.clear();
@@ -167047,7 +167047,7 @@ ${lanes.join("\n")}
167047
167047
  return {
167048
167048
  addAggregateStatistic,
167049
167049
  forEachAggregateStatistics: forEachAggreateStatistics,
167050
- clear: clear22
167050
+ clear: clear2
167051
167051
  };
167052
167052
  function addAggregateStatistic(s) {
167053
167053
  const existing = statistics == null ? void 0 : statistics.get(s.name);
@@ -167061,7 +167061,7 @@ ${lanes.join("\n")}
167061
167061
  function forEachAggreateStatistics(cb) {
167062
167062
  statistics == null ? void 0 : statistics.forEach(cb);
167063
167063
  }
167064
- function clear22() {
167064
+ function clear2() {
167065
167065
  statistics = void 0;
167066
167066
  }
167067
167067
  }
@@ -211598,7 +211598,7 @@ ${options.prefix}` : "\n" : options.prefix
211598
211598
  function isAtStartOfLine() {
211599
211599
  return writer.isAtStartOfLine();
211600
211600
  }
211601
- function clear22() {
211601
+ function clear2() {
211602
211602
  writer.clear();
211603
211603
  lastNonTriviaPosition = 0;
211604
211604
  }
@@ -211633,7 +211633,7 @@ ${options.prefix}` : "\n" : options.prefix
211633
211633
  isAtStartOfLine,
211634
211634
  hasTrailingComment: () => writer.hasTrailingComment(),
211635
211635
  hasTrailingWhitespace: () => writer.hasTrailingWhitespace(),
211636
- clear: clear22
211636
+ clear: clear2
211637
211637
  };
211638
211638
  }
211639
211639
  function getInsertionPositionAtSourceFileTop(sourceFile) {
@@ -216164,7 +216164,7 @@ ${options.prefix}` : "\n" : options.prefix
216164
216164
  classicNameResolver: () => classicNameResolver,
216165
216165
  classifier: () => ts_classifier_exports,
216166
216166
  cleanExtendedConfigCache: () => cleanExtendedConfigCache,
216167
- clear: () => clear2,
216167
+ clear: () => clear,
216168
216168
  clearMap: () => clearMap,
216169
216169
  clearSharedExtendedConfigFileWatcher: () => clearSharedExtendedConfigFileWatcher,
216170
216170
  climbPastPropertyAccess: () => climbPastPropertyAccess,
@@ -218161,7 +218161,7 @@ ${options.prefix}` : "\n" : options.prefix
218161
218161
  walkUpParenthesizedTypesAndGetParentAndChild: () => walkUpParenthesizedTypesAndGetParentAndChild,
218162
218162
  whitespaceOrMapCommentRegExp: () => whitespaceOrMapCommentRegExp,
218163
218163
  writeCommentRange: () => writeCommentRange,
218164
- writeFile: () => writeFile9,
218164
+ writeFile: () => writeFile10,
218165
218165
  writeFileEnsuringDirectories: () => writeFileEnsuringDirectories,
218166
218166
  zipWith: () => zipWith
218167
218167
  });
@@ -219501,7 +219501,7 @@ ${options.prefix}` : "\n" : options.prefix
219501
219501
  p.addMissingFileRoot(existingRoot.fileName);
219502
219502
  }
219503
219503
  }
219504
- clear2(this.containingProjects);
219504
+ clear(this.containingProjects);
219505
219505
  }
219506
219506
  getDefaultProject() {
219507
219507
  switch (this.containingProjects.length) {
@@ -240004,28 +240004,28 @@ var require_sha256 = __commonJS({
240004
240004
  this.outer = new Hash();
240005
240005
  this.blockSize = this.inner.blockSize;
240006
240006
  this.digestLength = this.inner.digestLength;
240007
- var pad2 = new Uint8Array(this.blockSize);
240007
+ var pad = new Uint8Array(this.blockSize);
240008
240008
  if (key2.length > this.blockSize) {
240009
- new Hash().update(key2).finish(pad2).clean();
240009
+ new Hash().update(key2).finish(pad).clean();
240010
240010
  } else {
240011
240011
  for (var i = 0; i < key2.length; i++) {
240012
- pad2[i] = key2[i];
240012
+ pad[i] = key2[i];
240013
240013
  }
240014
240014
  }
240015
- for (var i = 0; i < pad2.length; i++) {
240016
- pad2[i] ^= 54;
240015
+ for (var i = 0; i < pad.length; i++) {
240016
+ pad[i] ^= 54;
240017
240017
  }
240018
- this.inner.update(pad2);
240019
- for (var i = 0; i < pad2.length; i++) {
240020
- pad2[i] ^= 54 ^ 92;
240018
+ this.inner.update(pad);
240019
+ for (var i = 0; i < pad.length; i++) {
240020
+ pad[i] ^= 54 ^ 92;
240021
240021
  }
240022
- this.outer.update(pad2);
240022
+ this.outer.update(pad);
240023
240023
  this.istate = new Uint32Array(8);
240024
240024
  this.ostate = new Uint32Array(8);
240025
240025
  this.inner._saveState(this.istate);
240026
240026
  this.outer._saveState(this.ostate);
240027
- for (var i = 0; i < pad2.length; i++) {
240028
- pad2[i] = 0;
240027
+ for (var i = 0; i < pad.length; i++) {
240028
+ pad[i] = 0;
240029
240029
  }
240030
240030
  }
240031
240031
  HMAC2.prototype.reset = function() {
@@ -242011,10 +242011,10 @@ async function setupSkills(ctx) {
242011
242011
  for (const skill of session.agent.skills) {
242012
242012
  try {
242013
242013
  const version = await client.beta.skills.versions.retrieve(skill.version, { skill_id: skill.skill_id });
242014
- let dirname23 = path2.basename(version.name.trim());
242015
- if (dirname23 === "" || dirname23 === "." || dirname23 === "..")
242016
- dirname23 = skill.skill_id;
242017
- const dest = path2.resolve(skillsRoot, dirname23);
242014
+ let dirname24 = path2.basename(version.name.trim());
242015
+ if (dirname24 === "" || dirname24 === "." || dirname24 === "..")
242016
+ dirname24 = skill.skill_id;
242017
+ const dest = path2.resolve(skillsRoot, dirname24);
242018
242018
  if (dest !== skillsRoot && !dest.startsWith(skillsRoot + path2.sep)) {
242019
242019
  log.warn("skill name escapes the skills dir; skipping", {
242020
242020
  component: "agent-tool-context",
@@ -295396,7 +295396,7 @@ init_cjs_shims();
295396
295396
  // package.json
295397
295397
  var package_default = {
295398
295398
  name: "@arsh342/athena",
295399
- version: "0.4.3",
295399
+ version: "0.4.4",
295400
295400
  description: "AI code provenance tracker and terminal scanner for JavaScript/TypeScript, Python, Java, C#, C/C++, Go, Rust, PHP and Shell repositories.",
295401
295401
  type: "module",
295402
295402
  bin: {
@@ -295948,12 +295948,7 @@ async function initCommand(opts = {}) {
295948
295948
 
295949
295949
  // src/commands/menu.ts
295950
295950
  init_cjs_shims();
295951
- var import_node_readline = require("readline");
295952
-
295953
- // src/commands/keys.ts
295954
- init_cjs_shims();
295955
- var import_promises22 = require("readline/promises");
295956
- var import_node_stream2 = require("stream");
295951
+ init_dist2();
295957
295952
 
295958
295953
  // ../agents/dist/light.js
295959
295954
  init_cjs_shims();
@@ -295963,65 +295958,43 @@ init_pricing();
295963
295958
  init_usage2();
295964
295959
  init_consent();
295965
295960
 
295966
- // src/commands/keys.ts
295967
- var PRESET_NAMES = ["openrouter", "deepseek", "mistral", "groq", "xai", "together"];
295968
- function resolve10(name, opts) {
295969
- return PRESET_NAMES.includes(name) && !opts.preset ? { name: "openai-compatible", opts: { preset: name } } : { name, opts };
295970
- }
295971
- function provider(name) {
295972
- if (!PROVIDERS.includes(name)) throw new UsageError(`unknown provider "${name}" (use ${PROVIDERS.join(", ")})`);
295973
- return name;
295974
- }
295975
- async function readSecret() {
295976
- if (!process.stdin.isTTY) {
295977
- const chunks = [];
295978
- for await (const chunk of process.stdin) chunks.push(chunk);
295979
- return Buffer.concat(chunks).toString("utf8").trim();
295961
+ // src/commands/alerts.ts
295962
+ init_cjs_shims();
295963
+ var import_node_path55 = require("path");
295964
+ var import_promises22 = require("fs/promises");
295965
+ init_dist2();
295966
+ async function alertsCommand(dir3 = ".") {
295967
+ const given = (0, import_node_path55.resolve)(process.cwd(), dir3);
295968
+ const root = (await (0, import_promises22.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path55.dirname)(given) : given;
295969
+ const report = await loadLastScan(root);
295970
+ if (!report) {
295971
+ writeInfo(`error: no saved scan for ${root}; run athena scan first`);
295972
+ return 2;
295980
295973
  }
295981
- const muted = new import_node_stream2.Writable({ write: (_c, _e, done) => done() });
295982
- process.stderr.write("Key (input is hidden): ");
295983
- const rl = (0, import_promises22.createInterface)({ input: process.stdin, output: muted, terminal: true });
295984
- try {
295985
- return (await rl.question("")).trim();
295986
- } finally {
295987
- rl.close();
295988
- process.stderr.write("\n");
295974
+ if (!report.inventory || report.inventory.length === 0) {
295975
+ writeInfo("the last scan found no dependencies to re-check");
295976
+ return 0;
295989
295977
  }
295990
- }
295991
- async function keysSet(rawName, rawOpts = {}) {
295992
- const { name, opts } = resolve10(rawName, rawOpts);
295993
- const p = provider(name);
295994
- const key2 = await readSecret();
295995
- if (!key2) {
295996
- writeInfo("error: no key was given (pipe it in, or type it at the prompt)");
295997
- return 2;
295978
+ const { alerts, missing, checked } = newAlerts(report);
295979
+ if (missing.length > 0) writeInfo(`no local advisory data for ${missing.join(", ")}: run athena update --ecosystem ${missing.join(",")}`);
295980
+ if (checked === 0) return 2;
295981
+ if (alerts.length === 0) {
295982
+ writeResult(`No new vulnerabilities since your last scan (${report.timestamp.slice(0, 10)}); ${checked} packages re-checked.`);
295983
+ return 0;
295998
295984
  }
295999
- setKey(p, key2, opts.preset ? { preset: opts.preset } : {});
296000
- writeInfo(`saved the ${p}${opts.preset ? ` (${opts.preset})` : ""} key to your private credentials file`);
296001
- return 0;
296002
- }
296003
- function keysStatus() {
296004
- const lines = ["Provider Source Key"];
296005
- for (const p of PROVIDERS) {
296006
- const s = keyStatus(p);
296007
- lines.push(`${p.padEnd(19)} ${s.source.padEnd(13)} ${s.masked ?? (s.source === "sdk-default" ? "resolved by the Anthropic SDK when used" : "-")}`);
295985
+ const lines = [`${alerts.length} new vulnerabilit${alerts.length === 1 ? "y affects" : "ies affect"} ${root} since your last scan (${report.timestamp.slice(0, 10)}):`];
295986
+ for (const a of alerts.sort((x, y) => x.name.localeCompare(y.name))) {
295987
+ lines.push(` ${a.advisory.severity.padEnd(8)} ${a.name}@${a.version} ${a.advisory.id} ${a.advisory.summary}${a.advisory.fixed.length ? ` (fixed in ${a.advisory.fixed.sort().pop()})` : ""} ${a.manifest}`);
296008
295988
  }
296009
- if (!credentialsFileExists()) lines.push("", "No keys are stored. Set one with: athena keys set <provider>");
295989
+ lines.push("", "Run athena scan to update the report.");
296010
295990
  writeResult(lines.join("\n"));
296011
- return 0;
296012
- }
296013
- function keysRemove(rawName, rawOpts = {}) {
296014
- const { name, opts } = resolve10(rawName, rawOpts);
296015
- const p = provider(name);
296016
- const removed = removeKey(p, opts.preset ? { preset: opts.preset } : {});
296017
- writeInfo(removed ? `removed the stored ${p} key` : `no stored ${p} key`);
296018
- return removed ? 0 : 2;
295991
+ return 1;
296019
295992
  }
296020
295993
 
296021
295994
  // src/commands/review.ts
296022
295995
  init_cjs_shims();
296023
295996
  var import_promises23 = require("fs/promises");
296024
- var import_node_path55 = require("path");
295997
+ var import_node_path56 = require("path");
296025
295998
  init_dist2();
296026
295999
  var MANIFEST2 = /(?:^|\/)(?:package(?:-lock)?\.json|npm-shrinkwrap\.json|yarn\.lock|pnpm-lock\.yaml|requirements[\w.-]*\.txt|poetry\.lock|Pipfile\.lock|uv\.lock|pyproject\.toml|pom\.xml|gradle\.lockfile|packages\.lock\.json|[\w.-]+\.(?:cs|fs|vb)proj|go\.mod|go\.sum|Cargo\.(?:lock|toml)|composer\.lock|vcpkg\.json|conan\.lock)$/;
296027
296000
  function scopeOf(flags) {
@@ -296058,7 +296031,7 @@ async function reviewCommand(flags) {
296058
296031
  const excluded = [];
296059
296032
  for (const f of changes.files) {
296060
296033
  if (f.status === "deleted" || f.binary) continue;
296061
- const abs = (0, import_node_path55.resolve)(root, f.path);
296034
+ const abs = (0, import_node_path56.resolve)(root, f.path);
296062
296035
  if (!await (0, import_promises23.access)(abs).then(() => true, () => false) || !(await (0, import_promises23.stat)(abs)).isFile()) continue;
296063
296036
  if (isExcludedPath(abs, root, options.exclude)) {
296064
296037
  excluded.push(abs);
@@ -296079,315 +296052,30 @@ async function reviewCommand(flags) {
296079
296052
  options: scoped,
296080
296053
  review: { changes, scope: diff.label }
296081
296054
  });
296082
- void import_node_path55.join;
296055
+ void import_node_path56.join;
296083
296056
  }
296084
296057
 
296085
296058
  // src/commands/scan.ts
296086
296059
  init_cjs_shims();
296087
296060
  var import_promises24 = require("fs/promises");
296088
- var import_node_path56 = require("path");
296061
+ var import_node_path57 = require("path");
296089
296062
  async function scanCommand(dir3, flags) {
296090
- const given = (0, import_node_path56.resolve)(process.cwd(), dir3);
296091
- const root = (await (0, import_promises24.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path56.dirname)(given) : given;
296063
+ const given = (0, import_node_path57.resolve)(process.cwd(), dir3);
296064
+ const root = (await (0, import_promises24.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path57.dirname)(given) : given;
296092
296065
  const options = resolveRunOptions(flags, await loadProjectConfig(root), process.env, Boolean(process.stdout.isTTY));
296093
296066
  const { files, excluded, textFiles } = await findSourceFilesWithExclusions(given, options.exclude);
296094
296067
  process.exitCode = await runScan({ mode: "scan", root, target: dir3, files, excluded, textFiles, options });
296095
296068
  }
296096
296069
 
296097
- // src/commands/uninstall.ts
296098
- init_cjs_shims();
296099
- var import_promises25 = require("fs/promises");
296100
- var import_node_fs33 = require("fs");
296101
- var import_node_path57 = require("path");
296102
- async function uninstallCommand() {
296103
- const root = await getGitRoot();
296104
- const hooksDir = await getGitHooksDir();
296105
- if (!root || !hooksDir) {
296106
- console.error("Athena needs a git repository for hook uninstall.");
296107
- process.exitCode = 1;
296108
- return;
296109
- }
296110
- let removed = 0;
296111
- for (const name of ["pre-commit", "pre-push"]) {
296112
- const path5 = (0, import_node_path57.join)(root, hooksDir, name);
296113
- if ((0, import_node_fs33.existsSync)(path5) && isAthenaHook(path5)) {
296114
- await (0, import_promises25.rm)(path5, { force: true });
296115
- console.log(`Athena ${name} hook removed from ${path5}`);
296116
- removed += 1;
296117
- } else if ((0, import_node_fs33.existsSync)(path5)) console.log(`${path5} is not Athena's; left unchanged`);
296118
- }
296119
- if (removed === 0) console.log("No Athena hooks found.");
296120
- }
296121
-
296122
- // src/utils/banner.ts
296123
- init_cjs_shims();
296124
- var LOGO = [
296125
- "\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2840\u2884\u2884\u2822\u2842\u2886\u2822\u2842\u2844\u2884",
296126
- "\u2800\u2800\u2800\u2800\u2800\u2860\u2822\u2851\u285C\u2894\u2885\u2887\u28A3\u28A3\u28A3\u28A3\u28A3\u2823\u2843\u2847\u28C2\u2880",
296127
- "\u2800\u2800\u2800\u2860\u284A\u2862\u2843\u2847\u284E\u284E\u284E\u284E\u28CE\u288E\u28AE\u28AA\u286A\u28EA\u28A3\u2863\u2863\u2863\u28C2",
296128
- "\u2800\u2800\u2894\u28A2\u28B1\u28A1\u28A3\u28E3\u28E3\u2863\u2873\u2879\u28F8\u28AA\u28E3\u28B3\u28B9\u28F8\u28F8\u2878\u286A\u284E\u28CE\u288E\u2804",
296129
- "\u2800\u288C\u2886\u28A3\u2872\u28FD\u2873\u2833\u2833\u28AF\u28F7\u28DD\u28BC\u2871\u28F1\u28F3\u287B\u283A\u283A\u28BD\u28D7\u28E7\u28A3\u2887\u28A7",
296130
- "\u2820\u2871\u28B8\u28B0\u28FB\u2847\u2830\u2876\u2800\u2800\u28BF\u287E\u286E\u28DA\u28DE\u28DE\u2820\u28B6\u2802\u2800\u28B9\u28FE\u2857\u28DD\u289C\u2844",
296131
- "\u2828\u2878\u2858\u285C\u2877\u28E7\u2840\u2800\u2890\u28E0\u28FF\u28BF\u2895\u28C7\u28BF\u28FA\u28C0\u2800\u2810\u2882\u28FC\u28FF\u2887\u28D7\u28B5\u2805",
296132
- "\u2808\u2846\u2847\u2847\u28CF\u28BF\u28FB\u28FF\u28BF\u28FB\u289E\u28AF\u2873\u28F3\u289D\u287D\u28FB\u287F\u28FF\u287F\u28DF\u28AF\u287A\u28DC\u288E\u2807",
296133
- "\u2800\u2815\u285C\u285C\u28DC\u289C\u28A6\u28B3\u289D\u28AE\u282B\u2893\u28BD\u28D5\u289B\u28AA\u28D7\u2875\u28F3\u28B5\u28F3\u2873\u28DD\u288E\u2827\u2801",
296134
- "\u2800\u2808\u28AA\u28AA\u28AA\u288E\u2897\u28DD\u28B5\u286B\u28CF\u2822\u28F9\u2857\u2868\u28EA\u289E\u28DE\u287D\u28D5\u28D7\u28DD\u28AE\u28AB\u2801",
296135
- "\u2800\u2800\u2800\u2831\u2871\u2895\u28A7\u28B3\u2835\u28DD\u289E\u286C\u28B8\u2843\u288E\u28BE\u289D\u28DE\u28AE\u2873\u2875\u2855\u2847\u2801",
296136
- "\u2800\u2800\u2800\u2800\u2808\u280A\u282E\u286A\u28EB\u28AA\u2873\u28D5\u2895\u28B5\u2879\u28DD\u28B5\u28D3\u2897\u285D\u280E\u280A",
296137
- "\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2801\u2811\u2831\u2831\u2823\u286B\u28A3\u282B\u282A\u2803\u2803\u2801"
296138
- ];
296139
- var WORDMARK = [
296140
- "\u2584\u2580\u2588 \u2580\u2588\u2580 \u2588 \u2588 \u2588\u2580\u2580 \u2588\u2584 \u2588 \u2584\u2580\u2588",
296141
- "\u2588\u2580\u2588 \u2588 \u2588\u2580\u2588 \u2588\u2588\u2584 \u2588 \u2580\u2588 \u2588\u2580\u2588"
296142
- ];
296143
- var LOGO_WIDTH = Math.max(...LOGO.map((l) => l.length));
296144
- var GAP = 4;
296145
- var FULL_WIDTH = 2 + LOGO_WIDTH + GAP + Math.max(...WORDMARK.map((l) => l.length));
296146
- var FULL_ROWS = 52;
296147
- function bannerLines(cols, rows = Infinity) {
296148
- if (cols < FULL_WIDTH || rows < FULL_ROWS) return [...WORDMARK];
296149
- const top = Math.floor((LOGO.length - WORDMARK.length) / 2);
296150
- return LOGO.map((line2, i) => {
296151
- const name = WORDMARK[i - top];
296152
- return name ? `${line2.padEnd(LOGO_WIDTH, " ")}${" ".repeat(GAP)}${name}` : line2;
296153
- });
296154
- }
296155
- function printBanner() {
296156
- if (!process.stdout.isTTY) return;
296157
- console.log("");
296158
- for (const line2 of bannerLines(process.stdout.columns ?? 80, process.stdout.rows ?? Infinity)) {
296159
- console.log(` ${c.accent}${c.bold}${line2}${c.reset}`);
296160
- }
296161
- }
296162
- function dashedLine(width) {
296163
- const dashes = "\u2500 ".repeat(Math.floor(width / 2));
296164
- return `${c.gray}${dashes.trimEnd()}${c.reset}`;
296165
- }
296166
- function truncate(value, max) {
296167
- if (value.length <= max) return value;
296168
- return `\u2026${value.slice(value.length - max + 1)}`;
296169
- }
296170
-
296171
- // src/utils/terminal.ts
296172
- init_cjs_shims();
296173
- function clearScreen() {
296174
- process.stdout.write("\x1B[3J\x1B[2J\x1B[H");
296175
- }
296176
-
296177
- // src/commands/menu.ts
296178
- async function menuCommand(program3) {
296179
- if (!process.stdin.isTTY || !process.stdout.isTTY) {
296180
- program3.outputHelp();
296181
- return;
296182
- }
296183
- const items = [
296184
- {
296185
- label: "Scan current directory",
296186
- desc: "Scan every supported language from here (add --ai for verification).",
296187
- command: "athena scan .",
296188
- detail: "Offline: parses code, traces tainted data, finds secrets and risky dependencies, estimates AI provenance, prints a report.",
296189
- run: () => scanCommand(".", { format: "terminal" })
296190
- },
296191
- {
296192
- label: "Review my changes",
296193
- desc: "Review staged changes and report only what they introduced.",
296194
- command: "athena review",
296195
- detail: "Like a code review before you commit. Also: --uncommitted, --range origin/main..HEAD, --base main, --format markdown.",
296196
- run: () => reviewCommand({ format: "terminal" })
296197
- },
296198
- {
296199
- label: "Check staged files",
296200
- desc: "Fast gate for the commit flow (what the pre-commit hook runs).",
296201
- command: "athena check",
296202
- detail: "Scans staged files and exits 1 when a finding reaches your --fail-on level.",
296203
- run: () => checkCommand([], { format: "terminal" })
296204
- },
296205
- {
296206
- label: "Install git hooks",
296207
- desc: "Add a pre-commit gate (pre-push with --hooks pre-commit,pre-push).",
296208
- command: "athena init",
296209
- detail: "Respects Husky, lefthook and core.hooksPath. Skip once with ATHENA_SKIP=1.",
296210
- run: () => initCommand()
296211
- },
296212
- {
296213
- label: "Update advisory data",
296214
- desc: "Refresh the local vulnerability database, KEV and EPSS.",
296215
- command: "athena update",
296216
- detail: "Dependency checks then work offline. Use athena alerts to see new advisories for your lockfiles.",
296217
- run: async () => {
296218
- process.exitCode = await updateCommand();
296219
- }
296220
- },
296221
- {
296222
- label: "AI keys",
296223
- desc: "See which AI provider keys Athena can use (optional layer).",
296224
- command: "athena keys status",
296225
- detail: "Set one with: athena keys set anthropic | openai | google | groq. Keys are stored privately; spend is capped per run and per day.",
296226
- run: () => {
296227
- process.exitCode = keysStatus();
296228
- }
296229
- },
296230
- {
296231
- label: "Remove git hooks",
296232
- desc: "Delete Athena's git hooks.",
296233
- command: "athena uninstall",
296234
- detail: "Removes the hooks Athena installed. Your own hooks are left alone.",
296235
- run: uninstallCommand
296236
- },
296237
- {
296238
- label: "Show help",
296239
- desc: "Print every command and option.",
296240
- command: "athena --help",
296241
- detail: "Includes mcp (agent toolbox), skills, provenance, models and explain.",
296242
- run: () => program3.outputHelp()
296243
- },
296244
- {
296245
- label: "Doctor",
296246
- desc: "Check node, git and optional tools.",
296247
- command: "athena doctor",
296248
- detail: "Useful for debugging a missing toolchain.",
296249
- run: doctorCommand
296250
- },
296251
- {
296252
- label: "Exit",
296253
- desc: "Close selector.",
296254
- command: "q",
296255
- detail: "Leave terminal selector without running command.",
296256
- run: () => void 0
296257
- }
296258
- ];
296259
- enterAltScreen();
296260
- try {
296261
- while (true) {
296262
- const choice = await select(items);
296263
- if (choice === null || items[choice]?.label === "Exit") {
296264
- break;
296265
- }
296266
- exitAltScreen();
296267
- try {
296268
- await items[choice].run();
296269
- await waitForReturnToMenu();
296270
- } finally {
296271
- enterAltScreen();
296272
- }
296273
- }
296274
- } finally {
296275
- exitAltScreen();
296276
- }
296277
- console.log(`
296278
- ${c.dim}athena selector closed${c.reset}
296279
- `);
296280
- }
296281
- async function select(items) {
296282
- const historyText = formatRecentHistory(await getRecentScanHistory(3));
296283
- (0, import_node_readline.emitKeypressEvents)(process.stdin);
296284
- process.stdin.setRawMode(true);
296285
- process.stdin.resume();
296286
- let index = 0;
296287
- render2(items, index, historyText);
296288
- return new Promise((resolve18) => {
296289
- const cleanup = () => {
296290
- process.stdin.setRawMode(false);
296291
- process.stdin.pause();
296292
- process.stdin.off("keypress", onKeypress);
296293
- };
296294
- const done = (value) => {
296295
- cleanup();
296296
- resolve18(value);
296297
- };
296298
- const onKeypress = (_input, key2) => {
296299
- if (key2.ctrl && key2.name === "c") done(null);
296300
- if (key2.name === "q" || key2.name === "escape") done(null);
296301
- if (key2.name === "up") {
296302
- index = (index - 1 + items.length) % items.length;
296303
- render2(items, index, historyText);
296304
- }
296305
- if (key2.name === "down") {
296306
- index = (index + 1) % items.length;
296307
- render2(items, index, historyText);
296308
- }
296309
- if (key2.name === "return") done(index);
296310
- const number = Number(key2.sequence);
296311
- if (Number.isInteger(number) && number >= 1 && number <= Math.min(9, items.length)) {
296312
- done(number - 1);
296313
- }
296314
- };
296315
- process.stdin.on("keypress", onKeypress);
296316
- });
296317
- }
296318
- function render2(items, selected, historyText) {
296319
- clear();
296320
- const cols = Math.min(process.stdout.columns ?? 80, 72);
296321
- const selectedItem = items[selected];
296322
- printBanner();
296323
- console.log("");
296324
- console.log(` ${c.dim}Security review for AI-assisted code${c.reset}${pad(cols - 40)}${c.accent}v${CLI_VERSION}${c.reset}`);
296325
- console.log(` ${c.dim}${truncate(process.cwd(), cols - 4)}${c.reset}`);
296326
- console.log("");
296327
- console.log(` ${dashedLine(cols - 4)}`);
296328
- console.log("");
296329
- console.log(` ${c.dim}\u2191/\u2193${c.reset} navigate ${c.dim}enter${c.reset} run ${c.dim}1-${Math.min(9, items.length)}${c.reset} jump ${c.dim}q${c.reset} quit`);
296330
- console.log(` ${c.dim}${truncate(historyText, cols - 4)}${c.reset}`);
296331
- console.log("");
296332
- for (let i = 0; i < items.length; i++) {
296333
- const item = items[i];
296334
- const active = i === selected;
296335
- const marker = active ? `${c.accent}\u25CF${c.reset}` : `${c.gray}\u25CB${c.reset}`;
296336
- const num = `${c.gray}${i + 1}.${c.reset}`;
296337
- const label = active ? `${c.inverse} ${item.label} ${c.reset}` : `${c.bold}${item.label}${c.reset}`;
296338
- console.log(` ${marker} ${num} ${label}`);
296339
- console.log(` ${c.dim}${item.desc}${c.reset}`);
296340
- if (i < items.length - 1) console.log("");
296341
- }
296342
- console.log("");
296343
- console.log(` ${dashedLine(cols - 4)}`);
296344
- console.log("");
296345
- console.log(` ${c.bold}Preview${c.reset}`);
296346
- console.log(` ${c.accent}$ ${selectedItem.command}${c.reset}`);
296347
- console.log(` ${c.dim}${selectedItem.detail}${c.reset}`);
296348
- console.log("");
296349
- }
296350
- function clear() {
296351
- clearScreen();
296352
- }
296353
- function enterAltScreen() {
296354
- process.stdout.write("\x1B[?1049h");
296355
- }
296356
- function exitAltScreen() {
296357
- process.stdout.write("\x1B[?1049l");
296358
- }
296359
- function pad(n) {
296360
- return " ".repeat(Math.max(1, n));
296361
- }
296362
- async function waitForReturnToMenu() {
296363
- if (!process.stdin.isTTY || !process.stdout.isTTY) return;
296364
- console.log(` ${c.dim}press any key to return to selector${c.reset}`);
296365
- (0, import_node_readline.emitKeypressEvents)(process.stdin);
296366
- process.stdin.setRawMode(true);
296367
- process.stdin.resume();
296368
- await new Promise((resolve18) => {
296369
- const cleanup = () => {
296370
- process.stdin.setRawMode(false);
296371
- process.stdin.pause();
296372
- process.stdin.off("keypress", onKeypress);
296373
- };
296374
- const onKeypress = () => {
296375
- cleanup();
296376
- resolve18();
296377
- };
296378
- process.stdin.on("keypress", onKeypress);
296379
- });
296380
- }
296381
-
296382
296070
  // src/commands/skills.ts
296383
296071
  init_cjs_shims();
296384
- var import_promises26 = require("fs/promises");
296385
- var import_promises27 = require("readline/promises");
296072
+ var import_promises25 = require("fs/promises");
296073
+ var import_promises26 = require("readline/promises");
296386
296074
  var import_node_path58 = require("path");
296387
296075
  init_dist2();
296388
296076
  async function rootOf(path5) {
296389
296077
  const given = (0, import_node_path58.resolve)(process.cwd(), path5 ?? ".");
296390
- return (await (0, import_promises26.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path58.dirname)(given) : given;
296078
+ return (await (0, import_promises25.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path58.dirname)(given) : given;
296391
296079
  }
296392
296080
  async function projectProfile(root) {
296393
296081
  const { files, textFiles } = await findSourceFilesWithExclusions(root, ["node_modules", "dist", "build"]);
@@ -296396,7 +296084,7 @@ async function projectProfile(root) {
296396
296084
  const lang = detectLanguage(path5, "");
296397
296085
  if (!lang) continue;
296398
296086
  try {
296399
- const source = await (0, import_promises26.readFile)(path5, "utf8");
296087
+ const source = await (0, import_promises25.readFile)(path5, "utf8");
296400
296088
  if (isVendoredOrGenerated((0, import_node_path58.relative)(root, path5).split("\\").join("/"), source)) continue;
296401
296089
  sources.push({ path: path5, source, lang });
296402
296090
  } catch {
@@ -296455,7 +296143,7 @@ async function skillsShow(name, opts) {
296455
296143
  }
296456
296144
  async function confirm(question) {
296457
296145
  if (!process.stdin.isTTY) return false;
296458
- const rl = (0, import_promises27.createInterface)({ input: process.stdin, output: process.stderr });
296146
+ const rl = (0, import_promises26.createInterface)({ input: process.stdin, output: process.stderr });
296459
296147
  try {
296460
296148
  return /^y(es)?$/i.test((await rl.question(`${question} [y/N] `)).trim());
296461
296149
  } finally {
@@ -296535,7 +296223,7 @@ async function skillsNew(name, opts) {
296535
296223
  }
296536
296224
  async function skillsTest(path5) {
296537
296225
  const target = (0, import_node_path58.resolve)(process.cwd(), path5 ?? ".");
296538
- const dirs = await (0, import_promises26.stat)((0, import_node_path58.join)(target, "SKILL.md")).catch(() => null) ? [target] : await findChildSkillDirs(target);
296226
+ const dirs = await (0, import_promises25.stat)((0, import_node_path58.join)(target, "SKILL.md")).catch(() => null) ? [target] : await findChildSkillDirs(target);
296539
296227
  if (dirs.length === 0) {
296540
296228
  writeInfo(`error: no SKILL.md in ${target}`);
296541
296229
  return 2;
@@ -296560,23 +296248,664 @@ async function findChildSkillDirs(dir3) {
296560
296248
  const { readdir: readdir4 } = await import("fs/promises");
296561
296249
  const out = [];
296562
296250
  for (const entry of await readdir4(dir3, { withFileTypes: true }).catch(() => [])) {
296563
- if (entry.isDirectory() && await (0, import_promises26.stat)((0, import_node_path58.join)(dir3, entry.name, "SKILL.md")).catch(() => null)) out.push((0, import_node_path58.join)(dir3, entry.name));
296251
+ if (entry.isDirectory() && await (0, import_promises25.stat)((0, import_node_path58.join)(dir3, entry.name, "SKILL.md")).catch(() => null)) out.push((0, import_node_path58.join)(dir3, entry.name));
296564
296252
  }
296565
296253
  return out.sort();
296566
296254
  }
296567
296255
 
296568
- // src/commands/variants.ts
296256
+ // src/commands/uninstall.ts
296569
296257
  init_cjs_shims();
296570
- var import_promises28 = require("fs/promises");
296258
+ var import_promises27 = require("fs/promises");
296259
+ var import_node_fs33 = require("fs");
296571
296260
  var import_node_path59 = require("path");
296261
+ async function uninstallCommand() {
296262
+ const root = await getGitRoot();
296263
+ const hooksDir = await getGitHooksDir();
296264
+ if (!root || !hooksDir) {
296265
+ console.error("Athena needs a git repository for hook uninstall.");
296266
+ process.exitCode = 1;
296267
+ return;
296268
+ }
296269
+ let removed = 0;
296270
+ for (const name of ["pre-commit", "pre-push"]) {
296271
+ const path5 = (0, import_node_path59.join)(root, hooksDir, name);
296272
+ if ((0, import_node_fs33.existsSync)(path5) && isAthenaHook(path5)) {
296273
+ await (0, import_promises27.rm)(path5, { force: true });
296274
+ console.log(`Athena ${name} hook removed from ${path5}`);
296275
+ removed += 1;
296276
+ } else if ((0, import_node_fs33.existsSync)(path5)) console.log(`${path5} is not Athena's; left unchanged`);
296277
+ }
296278
+ if (removed === 0) console.log("No Athena hooks found.");
296279
+ }
296280
+
296281
+ // src/menu/flows.ts
296282
+ init_cjs_shims();
296283
+ var import_promises28 = require("fs/promises");
296284
+ var import_node_path60 = require("path");
296285
+ var SERVICES = [
296286
+ { id: "anthropic", label: "Anthropic (Claude)", provider: "anthropic" },
296287
+ { id: "openai", label: "OpenAI", provider: "openai" },
296288
+ { id: "google", label: "Google (Gemini)", provider: "google", note: "needs a one-time: npm i -g @google/genai" },
296289
+ { id: "groq", label: "Groq (has a free tier)", provider: "openai-compatible", preset: "groq", model: "openai/gpt-oss-120b" },
296290
+ { id: "openrouter", label: "OpenRouter", provider: "openai-compatible", preset: "openrouter" },
296291
+ { id: "deepseek", label: "DeepSeek", provider: "openai-compatible", preset: "deepseek" },
296292
+ { id: "mistral", label: "Mistral", provider: "openai-compatible", preset: "mistral" },
296293
+ { id: "xai", label: "xAI (Grok)", provider: "openai-compatible", preset: "xai" },
296294
+ { id: "together", label: "Together", provider: "openai-compatible", preset: "together" }
296295
+ ];
296296
+ function statusText(d2, s) {
296297
+ const st = d2.keyStatus(s.provider, s.preset ? { preset: s.preset } : {});
296298
+ if (st.source === "env") return `key from your environment${st.masked ? ` (${st.masked})` : ""}`;
296299
+ if (st.source === "file") return `key saved${st.masked ? ` (${st.masked})` : ""}`;
296300
+ if (st.source === "sdk-default") return "no saved key (uses your Anthropic login, if any)";
296301
+ return "no key yet";
296302
+ }
296303
+ function hasKey(d2, s) {
296304
+ const st = d2.keyStatus(s.provider, s.preset ? { preset: s.preset } : {});
296305
+ return st.source === "env" || st.source === "file";
296306
+ }
296307
+ var serviceOptions = (d2, list = SERVICES) => list.map((s) => ({ value: s, label: s.label, hint: statusText(d2, s) }));
296308
+ async function keysFlow(ui, d2) {
296309
+ for (; ; ) {
296310
+ const action = await ui.choose("AI keys", [
296311
+ { value: "add", label: "Add or replace a key", hint: "pick a service, paste the key (hidden)" },
296312
+ { value: "status", label: "See which keys are set", hint: "where each key comes from, masked" },
296313
+ { value: "remove", label: "Remove a saved key", hint: "deletes it from this machine" }
296314
+ ], { lede: "Optional: the AI check settles findings Athena is unsure about, with a spend cap. Keys stay on this machine (mode 0600)." });
296315
+ if (!action) return;
296316
+ if (action === "add") {
296317
+ const s = await ui.choose("Which service is the key for?", serviceOptions(d2));
296318
+ if (!s) continue;
296319
+ const key2 = await ui.ask(`Paste your ${s.label.split(" (")[0]} key`, { secret: true, hint: s.note ?? "It is saved privately and never printed." });
296320
+ if (!key2 || !key2.trim()) continue;
296321
+ try {
296322
+ d2.setKey(s.provider, key2.trim(), s.preset ? { preset: s.preset } : {});
296323
+ await ui.note(`Saved the ${s.label.split(" (")[0]} key to ${(0, import_node_path60.join)(d2.home, "credentials.json")} (private, mode 0600).
296324
+ Try it: choose Scan, then "Scan with the AI check".`);
296325
+ } catch (error) {
296326
+ await ui.note(`Could not save the key: ${error instanceof Error ? error.message : String(error)}`);
296327
+ }
296328
+ } else if (action === "status") {
296329
+ await ui.run("athena keys status", async () => {
296330
+ for (const s of SERVICES) console.log(` ${s.label.padEnd(26)} ${statusText(d2, s)}`);
296331
+ });
296332
+ } else {
296333
+ const saved = SERVICES.filter((s2) => d2.keyStatus(s2.provider, s2.preset ? { preset: s2.preset } : {}).source === "file");
296334
+ if (saved.length === 0) {
296335
+ await ui.note("No saved keys to remove. (Keys from environment variables are not stored by Athena.)");
296336
+ continue;
296337
+ }
296338
+ const s = await ui.choose("Remove which key?", serviceOptions(d2, saved));
296339
+ if (!s) continue;
296340
+ if (await ui.confirm(`Remove the saved ${s.label.split(" (")[0]} key?`)) {
296341
+ d2.removeKey(s.provider, s.preset ? { preset: s.preset } : {});
296342
+ await ui.note(`Removed the ${s.label.split(" (")[0]} key.`);
296343
+ }
296344
+ }
296345
+ }
296346
+ }
296347
+ async function aiChoiceFlow(ui, d2) {
296348
+ const ready = SERVICES.filter((s2) => hasKey(d2, s2));
296349
+ if (ready.length === 0) return "no-key";
296350
+ const s = ready.length === 1 ? ready[0] : await ui.choose("Which service should check the findings?", serviceOptions(d2, ready));
296351
+ if (!s) return null;
296352
+ const mode = await ui.choose("How much should the AI do?", [
296353
+ { value: "verify", label: "Verify (recommended)", hint: "checks only the findings Athena was unsure about" },
296354
+ { value: "hunt", label: "Hunt", hint: "also explores the riskiest components" },
296355
+ { value: "deep", label: "Deep", hint: "threat model and a three-voter panel; needs a spend cap" }
296356
+ ]);
296357
+ if (!mode) return null;
296358
+ const flags = { ai: mode, provider: s.provider };
296359
+ if (s.preset) flags.preset = s.preset;
296360
+ if (s.provider !== "anthropic") {
296361
+ const model = await ui.ask(`Which ${s.label.split(" (")[0]} model?`, { default: s.model ?? "", hint: "Required for this service. Example: " + (s.model ?? "the model id from your provider") });
296362
+ if (model === null) return null;
296363
+ if (!model.trim()) {
296364
+ await ui.note("A model id is needed for this service. Nothing was run.");
296365
+ return null;
296366
+ }
296367
+ flags.model = model.trim();
296368
+ }
296369
+ const budget = await ui.ask("Spend cap for this run, in US dollars", { default: mode === "deep" ? "1.00" : "0.25", hint: "Athena stops before a call could exceed it." });
296370
+ if (budget === null) return null;
296371
+ const n = Number(budget);
296372
+ if (!Number.isFinite(n) || n <= 0) {
296373
+ await ui.note("The cap must be a positive number. Nothing was run.");
296374
+ return null;
296375
+ }
296376
+ flags.budget = String(n);
296377
+ return flags;
296378
+ }
296379
+ var commandOf = (verb, dir3, flags) => {
296380
+ const parts = ["athena", verb];
296381
+ if (dir3) parts.push(dir3);
296382
+ if (flags.ai) parts.push(flags.ai === true ? "--ai" : `--ai ${String(flags.ai)}`);
296383
+ if (flags.provider) parts.push(`--provider ${flags.provider}`);
296384
+ if (flags.preset) parts.push(`--preset ${flags.preset}`);
296385
+ if (flags.model) parts.push(`--model ${flags.model}`);
296386
+ if (flags.budget) parts.push(`--budget ${flags.budget}`);
296387
+ if (flags.failOn) parts.push(`--fail-on ${flags.failOn}`);
296388
+ if (flags.format && flags.format !== "terminal") parts.push(`--format ${flags.format}`);
296389
+ if (flags.deps === false) parts.push("--no-deps");
296390
+ for (const k of ["staged", "uncommitted"]) if (flags[k]) parts.push(`--${k}`);
296391
+ for (const k of ["base", "range"]) if (flags[k]) parts.push(`--${k} ${String(flags[k])}`);
296392
+ return parts.join(" ");
296393
+ };
296394
+ async function scanFlow(ui, d2) {
296395
+ const what = await ui.choose("Scan", [
296396
+ { value: "quick", label: "Scan this folder", hint: "offline, every supported language", preview: { command: "athena scan .", detail: "Parses code, traces tainted data, finds secrets and risky dependencies, estimates AI provenance." } },
296397
+ { value: "ai", label: "Scan with the AI check", hint: "uses a key you added; capped spend", preview: { command: "athena scan . --ai verify", detail: "Also has an AI model settle the findings Athena was unsure about." } },
296398
+ { value: "folder", label: "Scan a different folder or file", hint: "type a path" },
296399
+ { value: "custom", label: "Choose options", hint: "what blocks, the output format, dependency checks" }
296400
+ ]);
296401
+ if (!what) return;
296402
+ let dir3 = ".";
296403
+ let flags = { format: "terminal" };
296404
+ if (what === "folder") {
296405
+ const p = await ui.ask("Which folder or file?", { default: ".", hint: "A path relative to where you started Athena." });
296406
+ if (p === null) return;
296407
+ dir3 = p.trim() || ".";
296408
+ } else if (what === "ai") {
296409
+ const ai = await aiChoiceFlow(ui, d2);
296410
+ if (ai === "no-key") {
296411
+ if (await ui.confirm("No AI key is set yet. Add one now?", true)) await keysFlow(ui, d2);
296412
+ return;
296413
+ }
296414
+ if (!ai) return;
296415
+ flags = { ...flags, ...ai };
296416
+ } else if (what === "custom") {
296417
+ const failOn = await ui.choose("What should block (exit code 1)?", [
296418
+ { value: "high", label: "High and above (default)" },
296419
+ { value: "critical", label: "Critical only" },
296420
+ { value: "medium", label: "Medium and above" },
296421
+ { value: "low", label: "Anything" },
296422
+ { value: "none", label: "Never block" }
296423
+ ]);
296424
+ if (!failOn) return;
296425
+ const format = await ui.choose("How should the report look?", [
296426
+ { value: "terminal", label: "In the terminal" },
296427
+ { value: "markdown", label: "Markdown (pull-request ready)" },
296428
+ { value: "json", label: "JSON" },
296429
+ { value: "sarif", label: "SARIF (GitHub code scanning)" }
296430
+ ]);
296431
+ if (!format) return;
296432
+ const deps = await ui.choose("Check dependencies for known vulnerabilities?", [
296433
+ { value: true, label: "Yes", hint: "looks up package names and versions online" },
296434
+ { value: false, label: "No, stay fully offline" }
296435
+ ]);
296436
+ if (deps === null) return;
296437
+ flags = { ...flags, failOn, format, ...deps ? {} : { deps: false } };
296438
+ }
296439
+ await ui.run(commandOf("scan", dir3 === "." ? "." : dir3, flags), () => d2.scan(dir3, flags));
296440
+ }
296441
+ async function reviewFlow(ui, d2) {
296442
+ const scope = await ui.choose("Review which changes?", [
296443
+ { value: "staged", label: "What I have staged", hint: "the default", preview: { command: "athena review", detail: "Reviews staged changes and reports only what they introduced." } },
296444
+ { value: "uncommitted", label: "Everything uncommitted", hint: "staged, unstaged and new files" },
296445
+ { value: "base", label: "Everything since a branch", hint: "for example, since main" },
296446
+ { value: "range", label: "A commit range", hint: "for example origin/main..HEAD" }
296447
+ ]);
296448
+ if (!scope) return;
296449
+ const flags = { format: "terminal" };
296450
+ if (scope === "staged") flags.staged = true;
296451
+ if (scope === "uncommitted") flags.uncommitted = true;
296452
+ if (scope === "base") {
296453
+ const b = await ui.ask("Compare against which branch?", { default: "main" });
296454
+ if (!b) return;
296455
+ flags.base = b.trim();
296456
+ }
296457
+ if (scope === "range") {
296458
+ const r = await ui.ask("Which range?", { default: "origin/main..HEAD", hint: "two refs joined by two dots" });
296459
+ if (!r) return;
296460
+ flags.range = r.trim();
296461
+ }
296462
+ const anyKey = SERVICES.some((s) => hasKey(d2, s));
296463
+ if (anyKey) {
296464
+ const withAi = await ui.choose("Add the AI check?", [
296465
+ { value: false, label: "No, offline only" },
296466
+ { value: true, label: "Yes", hint: "checks only the lines this change touched" }
296467
+ ]);
296468
+ if (withAi === null) return;
296469
+ if (withAi) {
296470
+ const ai = await aiChoiceFlow(ui, d2);
296471
+ if (!ai || ai === "no-key") return;
296472
+ Object.assign(flags, ai);
296473
+ }
296474
+ }
296475
+ await ui.run(commandOf("review", null, flags), () => d2.review(flags));
296476
+ }
296477
+ async function hooksFlow(ui, d2) {
296478
+ const what = await ui.choose("Git hooks", [
296479
+ { value: "commit", label: "Check every commit", hint: "a pre-commit gate, about a second on a typical commit", preview: { command: "athena init", detail: "Installs a pre-commit hook. Skip once with ATHENA_SKIP=1 git commit." } },
296480
+ { value: "both", label: "Check every commit and every push", hint: "adds a pre-push review of what you are about to push", preview: { command: "athena init --hooks pre-commit,pre-push", detail: "Husky, lefthook and core.hooksPath are detected and respected." } },
296481
+ { value: "remove", label: "Remove Athena's hooks", hint: "your own hooks are left alone", preview: { command: "athena uninstall", detail: "Deletes the hooks Athena installed." } }
296482
+ ]);
296483
+ if (!what) return;
296484
+ if (what === "remove") {
296485
+ if (!await ui.confirm("Remove Athena's git hooks from this repository?")) return;
296486
+ await ui.run("athena uninstall", () => d2.uninstall());
296487
+ return;
296488
+ }
296489
+ const hooks = what === "both" ? "pre-commit,pre-push" : void 0;
296490
+ await ui.run(hooks ? `athena init --hooks ${hooks}` : "athena init", () => d2.init(hooks ? { hooks } : {}));
296491
+ }
296492
+ async function settingsFlow(ui, d2) {
296493
+ const root = await d2.configRoot();
296494
+ const file4 = (0, import_node_path60.join)(root, "athena.config.json");
296495
+ let current = {};
296496
+ try {
296497
+ current = JSON.parse(await (0, import_promises28.readFile)(file4, "utf8"));
296498
+ } catch {
296499
+ }
296500
+ const level = await ui.choose("What should block a commit or fail a scan?", [
296501
+ { value: "high", label: "High and above", hint: current.failOn === "high" || !current.failOn ? "current (default)" : void 0 },
296502
+ { value: "critical", label: "Critical only", hint: current.failOn === "critical" ? "current" : void 0 },
296503
+ { value: "medium", label: "Medium and above", hint: current.failOn === "medium" ? "current" : void 0 },
296504
+ { value: "low", label: "Anything", hint: current.failOn === "low" ? "current" : void 0 },
296505
+ { value: "none", label: "Never block", hint: current.failOn === "none" ? "current" : void 0 }
296506
+ ], { lede: `Saved to ${file4}. Flags such as --fail-on still override it.` });
296507
+ if (!level) return;
296508
+ current.failOn = level;
296509
+ await (0, import_promises28.mkdir)((0, import_node_path60.dirname)(file4), { recursive: true });
296510
+ await (0, import_promises28.writeFile)(file4, `${JSON.stringify(current, null, 2)}
296511
+ `);
296512
+ await ui.note(`Saved: failOn is now "${level}" in
296513
+ ${file4}`);
296514
+ }
296515
+ async function mainMenu(ui, d2, header) {
296516
+ for (; ; ) {
296517
+ const action = await ui.choose("What would you like to do?", [
296518
+ { value: "scan", label: "Scan", hint: "this folder, with or without the AI check", preview: { command: "athena scan .", detail: "Parse code, trace tainted data, find secrets and risky dependencies, estimate AI provenance." } },
296519
+ { value: "review", label: "Review my changes", hint: "staged, uncommitted, a branch or a range", preview: { command: "athena review", detail: "Like a code review before you commit. Only what the change introduced counts." } },
296520
+ { value: "check", label: "Check staged files", hint: "the fast gate the pre-commit hook runs", preview: { command: "athena check", detail: "Exits 1 when a finding reaches your fail-on level." } },
296521
+ { value: "hooks", label: "Git hooks", hint: "install or remove the commit and push gates", preview: { command: "athena init", detail: "Respects Husky, lefthook and core.hooksPath." } },
296522
+ { value: "keys", label: "AI keys", hint: "add, see or remove a key for Anthropic, OpenAI, Google, Groq and more", preview: { command: "athena keys set <service>", detail: "Keys stay on this machine. Spend is capped per run and per day." } },
296523
+ { value: "update", label: "Vulnerability data", hint: "update advisories, or see what is new for your lockfiles", preview: { command: "athena update", detail: "Refreshes the local OSV database, KEV and EPSS so dependency checks work offline." } },
296524
+ { value: "explain", label: "Explain a finding", hint: "type the id from a report", preview: { command: "athena explain <id>", detail: "Why it matters and how to fix it." } },
296525
+ { value: "more", label: "Skills and provenance", hint: "what rules are active, who wrote what", preview: { command: "athena skills list", detail: "Skills switch on when your project uses a framework; provenance shows AI-written files." } },
296526
+ { value: "settings", label: "Project settings", hint: "what blocks a commit", preview: { command: "athena.config.json", detail: "Saved in your repository so everyone gets the same gate." } },
296527
+ { value: "doctor", label: "Doctor", hint: "check Node, git and optional tools", preview: { command: "athena doctor", detail: "Useful for debugging a missing tool." } },
296528
+ { value: "help", label: "All commands", hint: "the full command and flag reference", preview: { command: "athena --help", detail: "Everything the menu does, plus mcp, models and more." } }
296529
+ ], { header, footer: "\u2191/\u2193 move enter select 1-9 jump q quit" });
296530
+ if (!action) return;
296531
+ switch (action) {
296532
+ case "scan":
296533
+ await scanFlow(ui, d2);
296534
+ break;
296535
+ case "review":
296536
+ await reviewFlow(ui, d2);
296537
+ break;
296538
+ case "check":
296539
+ await ui.run("athena check", () => d2.check({ format: "terminal" }));
296540
+ break;
296541
+ case "hooks":
296542
+ await hooksFlow(ui, d2);
296543
+ break;
296544
+ case "keys":
296545
+ await keysFlow(ui, d2);
296546
+ break;
296547
+ case "settings":
296548
+ await settingsFlow(ui, d2);
296549
+ break;
296550
+ case "doctor":
296551
+ await ui.run("athena doctor", () => d2.doctor());
296552
+ break;
296553
+ case "help":
296554
+ await ui.run("athena --help", () => d2.help());
296555
+ break;
296556
+ case "update": {
296557
+ const w = await ui.choose("Vulnerability data", [
296558
+ { value: "update", label: "Update now", hint: "download the latest advisories and rule packs", preview: { command: "athena update", detail: "Only public data is downloaded; nothing about your code is sent." } },
296559
+ { value: "alerts", label: "What is new for my project?", hint: "new vulnerabilities since your last scan", preview: { command: "athena alerts", detail: "Exits 1 if any are found." } }
296560
+ ]);
296561
+ if (w === "update") await ui.run("athena update", () => d2.update());
296562
+ if (w === "alerts") await ui.run("athena alerts", () => d2.alerts());
296563
+ break;
296564
+ }
296565
+ case "explain": {
296566
+ const id = await ui.ask("Finding id", { hint: "The short id from a report, 4 or more characters. Example: 40fd25" });
296567
+ if (id && id.trim()) await ui.run(`athena explain ${id.trim()}`, () => d2.explain(id.trim()));
296568
+ break;
296569
+ }
296570
+ case "more": {
296571
+ const w = await ui.choose("Skills and provenance", [
296572
+ { value: "skills", label: "Which skills are active?", hint: "rules that switch on for your frameworks", preview: { command: "athena skills list", detail: "Also: athena skills show <name>." } },
296573
+ { value: "provenance", label: "Which files look AI-written?", hint: "per-file provenance for this folder", preview: { command: "athena provenance .", detail: "Recorded history is a floor; the model is an estimate." } }
296574
+ ]);
296575
+ if (w === "skills") await ui.run("athena skills list", () => d2.skills());
296576
+ if (w === "provenance") await ui.run("athena provenance .", () => d2.provenance());
296577
+ break;
296578
+ }
296579
+ }
296580
+ }
296581
+ }
296582
+
296583
+ // src/menu/ui.ts
296584
+ init_cjs_shims();
296585
+ var import_node_readline = require("readline");
296586
+
296587
+ // src/utils/banner.ts
296588
+ init_cjs_shims();
296589
+ var WORDMARK = [
296590
+ "\u2584\u2580\u2588 \u2580\u2588\u2580 \u2588 \u2588 \u2588\u2580\u2580 \u2588\u2584 \u2588 \u2584\u2580\u2588",
296591
+ "\u2588\u2580\u2588 \u2588 \u2588\u2580\u2588 \u2588\u2588\u2584 \u2588 \u2580\u2588 \u2588\u2580\u2588"
296592
+ ];
296593
+ function bannerLines() {
296594
+ return [...WORDMARK];
296595
+ }
296596
+ function dashedLine(width) {
296597
+ const dashes = "\u2500 ".repeat(Math.floor(width / 2));
296598
+ return `${c.gray}${dashes.trimEnd()}${c.reset}`;
296599
+ }
296600
+ function truncate(value, max) {
296601
+ if (value.length <= max) return value;
296602
+ return `\u2026${value.slice(value.length - max + 1)}`;
296603
+ }
296604
+
296605
+ // src/utils/terminal.ts
296606
+ init_cjs_shims();
296607
+ function clearScreen() {
296608
+ process.stdout.write("\x1B[3J\x1B[2J\x1B[H");
296609
+ }
296610
+
296611
+ // src/menu/ui.ts
296612
+ function layoutChoose(input) {
296613
+ const { rows, cols, title, lede, header = [], options, index, footer } = input;
296614
+ const budget = Math.max(5, rows - 1);
296615
+ const option = (i, hints) => {
296616
+ const o = options[i];
296617
+ const active = i === index;
296618
+ const marker = active ? `${c.accent}\u25CF${c.reset}` : `${c.gray}\u25CB${c.reset}`;
296619
+ const num = i < 9 ? `${c.gray}${i + 1}.${c.reset}` : " ";
296620
+ const label = active ? `${c.inverse} ${o.label} ${c.reset}` : `${c.bold}${o.label}${c.reset}`;
296621
+ const out = [` ${marker} ${num} ${label}`];
296622
+ if (o.hint && hints !== "none" && (hints === "all" || active)) out.push(` ${c.dim}${truncate(o.hint, cols - 9)}${c.reset}`);
296623
+ return out;
296624
+ };
296625
+ const preview = () => {
296626
+ const p = options[index].preview;
296627
+ return p ? ["", ` ${dashedLine(cols - 4)}`, "", ` ${c.accent}$ ${p.command}${c.reset}`, ` ${c.dim}${truncate(p.detail, cols - 4)}${c.reset}`] : [];
296628
+ };
296629
+ const intro = (withHeader, withLede) => [
296630
+ ...withHeader ? header : [],
296631
+ "",
296632
+ ` ${c.bold}${title}${c.reset}`,
296633
+ ...withLede && lede ? [` ${c.dim}${truncate(lede, cols - 4)}${c.reset}`] : [],
296634
+ ""
296635
+ ];
296636
+ const foot = (blank) => [...blank ? [""] : [], ` ${c.dim}${truncate(footer, cols - 4)}${c.reset}`];
296637
+ const tries = [
296638
+ { hints: "all", preview: true, header: true, lede: true, blank: true },
296639
+ { hints: "active", preview: true, header: true, lede: true, blank: true },
296640
+ { hints: "active", preview: false, header: true, lede: true, blank: true },
296641
+ { hints: "active", preview: false, header: false, lede: true, blank: true },
296642
+ { hints: "active", preview: false, header: false, lede: false, blank: false }
296643
+ ];
296644
+ for (const t of tries) {
296645
+ const lines = [...intro(t.header, t.lede), ...options.flatMap((_, i) => option(i, t.hints)), ...t.preview ? preview() : [], ...foot(t.blank)];
296646
+ if (lines.length <= budget) return lines;
296647
+ }
296648
+ const top = [` ${c.bold}${title}${c.reset}`];
296649
+ const bottom = foot(false);
296650
+ const room = Math.max(1, budget - top.length - bottom.length);
296651
+ const marks = room >= 3;
296652
+ const cost = (a, b, h2) => {
296653
+ let n = 0;
296654
+ for (let i = a; i < b; i += 1) n += option(i, h2).length;
296655
+ return n + (marks && a > 0 ? 1 : 0) + (marks && b < options.length ? 1 : 0);
296656
+ };
296657
+ const h = cost(index, index + 1, "active") <= room ? "active" : "none";
296658
+ let start = index;
296659
+ let end = index + 1;
296660
+ while (true) {
296661
+ const grewDown = end < options.length && cost(start, end + 1, h) <= room;
296662
+ if (grewDown) end += 1;
296663
+ const grewUp = start > 0 && cost(start - 1, end, h) <= room;
296664
+ if (grewUp) start -= 1;
296665
+ if (!grewDown && !grewUp) break;
296666
+ }
296667
+ return [
296668
+ ...top,
296669
+ ...marks && start > 0 ? [` ${c.dim}\u25B2 ${start} more${c.reset}`] : [],
296670
+ ...options.slice(start, end).flatMap((_, k) => option(start + k, h)),
296671
+ ...marks && end < options.length ? [` ${c.dim}\u25BC ${options.length - end} more${c.reset}`] : [],
296672
+ ...bottom
296673
+ ];
296674
+ }
296675
+ var enterAltScreen = () => {
296676
+ process.stdout.write("\x1B[?1049h");
296677
+ };
296678
+ var exitAltScreen = () => {
296679
+ process.stdout.write("\x1B[?1049l");
296680
+ };
296681
+ function readKeys(onKey) {
296682
+ (0, import_node_readline.emitKeypressEvents)(process.stdin);
296683
+ if (process.stdin.isTTY) process.stdin.setRawMode(true);
296684
+ process.stdin.resume();
296685
+ return new Promise((resolve18) => {
296686
+ const handler = (str2, key2 = {}) => {
296687
+ if (key2.ctrl && key2.name === "c") {
296688
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
296689
+ exitAltScreen();
296690
+ process.stdout.write("\x1B[?25h");
296691
+ process.exit(130);
296692
+ }
296693
+ if (onKey(str2, key2)) {
296694
+ process.stdin.off("keypress", handler);
296695
+ if (process.stdin.isTTY) process.stdin.setRawMode(false);
296696
+ process.stdin.pause();
296697
+ resolve18();
296698
+ }
296699
+ };
296700
+ process.stdin.on("keypress", handler);
296701
+ });
296702
+ }
296703
+ var TerminalUi = class {
296704
+ active = false;
296705
+ start() {
296706
+ if (this.active) return;
296707
+ this.active = true;
296708
+ enterAltScreen();
296709
+ }
296710
+ stop() {
296711
+ if (!this.active) return;
296712
+ this.active = false;
296713
+ exitAltScreen();
296714
+ process.stdout.write("\x1B[?25h");
296715
+ }
296716
+ async choose(title, options, opts = {}) {
296717
+ if (options.length === 0) return null;
296718
+ let index = 0;
296719
+ const draw = () => {
296720
+ clearScreen();
296721
+ const lines = layoutChoose({
296722
+ rows: process.stdout.rows ?? 60,
296723
+ cols: Math.min(process.stdout.columns ?? 80, 78),
296724
+ title,
296725
+ ...opts.lede ? { lede: opts.lede } : {},
296726
+ header: opts.header ?? [],
296727
+ options,
296728
+ index,
296729
+ footer: opts.footer ?? "\u2191/\u2193 move enter select esc back 1-9 jump ctrl-c quit"
296730
+ });
296731
+ process.stdout.write(lines.join("\n"));
296732
+ };
296733
+ draw();
296734
+ process.stdout.on("resize", draw);
296735
+ let result = null;
296736
+ try {
296737
+ await readKeys((_str, key2) => {
296738
+ if (key2.name === "up") {
296739
+ index = (index - 1 + options.length) % options.length;
296740
+ draw();
296741
+ return false;
296742
+ }
296743
+ if (key2.name === "down") {
296744
+ index = (index + 1) % options.length;
296745
+ draw();
296746
+ return false;
296747
+ }
296748
+ if (key2.name === "return") {
296749
+ result = options[index].value;
296750
+ return true;
296751
+ }
296752
+ if (key2.name === "escape" || key2.name === "q" || key2.name === "left") {
296753
+ result = null;
296754
+ return true;
296755
+ }
296756
+ const n = Number(key2.sequence);
296757
+ if (Number.isInteger(n) && n >= 1 && n <= Math.min(9, options.length)) {
296758
+ result = options[n - 1].value;
296759
+ return true;
296760
+ }
296761
+ return false;
296762
+ });
296763
+ } finally {
296764
+ process.stdout.off("resize", draw);
296765
+ }
296766
+ return result;
296767
+ }
296768
+ async ask(question, opts = {}) {
296769
+ let value = "";
296770
+ let cancelled = false;
296771
+ const draw = () => {
296772
+ clearScreen();
296773
+ const shown = opts.secret ? "\u2022".repeat(value.length) : value;
296774
+ const lines = ["", ` ${c.bold}${question}${c.reset}`];
296775
+ if (opts.hint) lines.push(` ${c.dim}${opts.hint}${c.reset}`);
296776
+ if (opts.default && !opts.secret) lines.push(` ${c.dim}enter keeps: ${opts.default}${c.reset}`);
296777
+ lines.push("", ` ${c.accent}\u203A${c.reset} ${shown}${c.dim}\u258F${c.reset}`, "", ` ${c.dim}enter confirm esc cancel${opts.secret ? " (what you type is hidden)" : ""}${c.reset}`);
296778
+ process.stdout.write(lines.join("\n"));
296779
+ };
296780
+ draw();
296781
+ process.stdout.write("\x1B[?25l");
296782
+ await readKeys((str2, key2) => {
296783
+ if (key2.name === "return") return true;
296784
+ if (key2.name === "escape") {
296785
+ cancelled = true;
296786
+ return true;
296787
+ }
296788
+ if (key2.name === "backspace") {
296789
+ value = value.slice(0, -1);
296790
+ draw();
296791
+ return false;
296792
+ }
296793
+ if (str2 && !key2.ctrl && !key2.meta && key2.name !== "tab" && !str2.startsWith("\x1B")) {
296794
+ value += str2;
296795
+ draw();
296796
+ return false;
296797
+ }
296798
+ return false;
296799
+ });
296800
+ process.stdout.write("\x1B[?25h");
296801
+ if (cancelled) return null;
296802
+ return value.length > 0 ? value : opts.default ?? "";
296803
+ }
296804
+ async confirm(question, defaultYes = false) {
296805
+ const yes = { value: true, label: "Yes" };
296806
+ const no = { value: false, label: "No" };
296807
+ return await this.choose(question, defaultYes ? [yes, no] : [no, yes]) === true;
296808
+ }
296809
+ async note(message) {
296810
+ clearScreen();
296811
+ process.stdout.write(`
296812
+ ${message.split("\n").join("\n ")}
296813
+
296814
+ ${c.dim}press any key to continue${c.reset}`);
296815
+ await readKeys(() => true);
296816
+ }
296817
+ async run(label, work) {
296818
+ exitAltScreen();
296819
+ process.stdout.write("\x1B[?25h");
296820
+ console.log(`
296821
+ ${c.dim}${label}${c.reset}
296822
+ `);
296823
+ try {
296824
+ await work();
296825
+ } catch (error) {
296826
+ console.error(`error: ${error instanceof Error ? error.message : String(error)}`);
296827
+ } finally {
296828
+ process.exitCode = void 0;
296829
+ }
296830
+ console.log(`
296831
+ ${c.dim}press any key to return to the menu${c.reset}`);
296832
+ await readKeys(() => true);
296833
+ if (this.active) enterAltScreen();
296834
+ }
296835
+ };
296836
+
296837
+ // src/commands/menu.ts
296838
+ function realDeps(program3) {
296839
+ return {
296840
+ keyStatus: (provider2, opts) => keyStatus(provider2, opts),
296841
+ setKey: (provider2, key2, opts) => setKey(provider2, key2, opts),
296842
+ removeKey: (provider2, opts) => removeKey(provider2, opts),
296843
+ scan: (dir3, flags) => scanCommand(dir3, flags),
296844
+ review: (flags) => reviewCommand(flags),
296845
+ check: (flags) => checkCommand([], flags),
296846
+ init: (opts) => initCommand(opts),
296847
+ uninstall: () => uninstallCommand(),
296848
+ update: async () => {
296849
+ process.exitCode = await updateCommand();
296850
+ },
296851
+ alerts: async () => {
296852
+ process.exitCode = await alertsCommand(".");
296853
+ },
296854
+ explain: async (id) => {
296855
+ process.exitCode = await explainCommand(id);
296856
+ },
296857
+ skills: async () => {
296858
+ process.exitCode = await skillsList({});
296859
+ },
296860
+ provenance: async () => {
296861
+ process.exitCode = await provenanceCommand(".");
296862
+ },
296863
+ doctor: () => doctorCommand(),
296864
+ help: () => program3.outputHelp(),
296865
+ configRoot: async () => await getGitTopLevel(process.cwd()) ?? process.cwd(),
296866
+ home: athenaHome()
296867
+ };
296868
+ }
296869
+ async function menuCommand(program3) {
296870
+ if (!process.stdin.isTTY || !process.stdout.isTTY) {
296871
+ program3.outputHelp();
296872
+ return;
296873
+ }
296874
+ const cols = Math.min(process.stdout.columns ?? 80, 72);
296875
+ const history = formatRecentHistory(await getRecentScanHistory(3));
296876
+ const header = [
296877
+ "",
296878
+ ...bannerLines().map((line2) => ` ${c.accent}${c.bold}${line2}${c.reset}`),
296879
+ "",
296880
+ ` ${c.dim}Security review for AI-assisted code${c.reset}${" ".repeat(Math.max(1, cols - 36 - CLI_VERSION.length - 1))}${c.accent}v${CLI_VERSION}${c.reset}`,
296881
+ ` ${c.dim}${truncate(process.cwd(), cols - 4)}${c.reset}`,
296882
+ ...history ? [` ${c.dim}${truncate(history, cols - 4)}${c.reset}`] : [],
296883
+ ` ${dashedLine(cols - 4)}`
296884
+ ];
296885
+ const ui = new TerminalUi();
296886
+ ui.start();
296887
+ try {
296888
+ await mainMenu(ui, realDeps(program3), header);
296889
+ } finally {
296890
+ ui.stop();
296891
+ }
296892
+ console.log(`
296893
+ ${c.dim}athena menu closed${c.reset}
296894
+ `);
296895
+ }
296896
+
296897
+ // src/commands/variants.ts
296898
+ init_cjs_shims();
296899
+ var import_promises29 = require("fs/promises");
296900
+ var import_node_path61 = require("path");
296572
296901
  init_dist2();
296573
296902
  async function variantsCommand(id, opts = {}) {
296574
296903
  const fail2 = (message) => {
296575
296904
  writeInfo(`error: ${message}`);
296576
296905
  return 2;
296577
296906
  };
296578
- const given = (0, import_node_path59.resolve)(process.cwd(), opts.path ?? ".");
296579
- const root = (await (0, import_promises28.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path59.dirname)(given) : given;
296907
+ const given = (0, import_node_path61.resolve)(process.cwd(), opts.path ?? ".");
296908
+ const root = (await (0, import_promises29.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path61.dirname)(given) : given;
296580
296909
  if (id.length < 4) return fail2("finding id must have at least 4 characters");
296581
296910
  const report = await loadLastScan(root);
296582
296911
  if (!report) return fail2(`no saved scan for ${root}; run athena scan first`);
@@ -296586,20 +296915,20 @@ async function variantsCommand(id, opts = {}) {
296586
296915
  const finding4 = found[0];
296587
296916
  const lang = detectLanguage(finding4.file, "");
296588
296917
  if (!lang) return fail2("unsupported language");
296589
- const source = await (0, import_promises28.readFile)(finding4.file, "utf8");
296918
+ const source = await (0, import_promises29.readFile)(finding4.file, "utf8");
296590
296919
  const rule = await deriveVariantRule({ ruleId: finding4.ruleId, file: finding4.file, line: finding4.line, code: finding4.code, severity: finding4.severity, category: finding4.category, title: finding4.type }, source, lang);
296591
296920
  if (!rule) return fail2("this finding is not a call to a function, so it cannot be generalised into a rule");
296592
296921
  const { files } = await findSourceFilesWithExclusions(root, ["node_modules", "dist", "build"]);
296593
296922
  const project = [];
296594
296923
  for (const path5 of files) {
296595
296924
  const l = detectLanguage(path5, "");
296596
- if (l) project.push({ path: path5, source: await (0, import_promises28.readFile)(path5, "utf8").catch(() => ""), lang: l });
296925
+ if (l) project.push({ path: path5, source: await (0, import_promises29.readFile)(path5, "utf8").catch(() => ""), lang: l });
296597
296926
  }
296598
296927
  const preview = await previewVariant(rule, project, root, { ruleId: finding4.ruleId, file: finding4.file, line: finding4.line, code: finding4.code });
296599
296928
  const info = getRuleInfo(finding4.ruleId);
296600
- const out = [`Derived from ${finding4.ruleId}${info ? ` (${info.title})` : ""} at ${(0, import_node_path59.relative)(root, finding4.file)}:${finding4.line}`, `Rule: ${rule.id} matches ${rule.match.callee} when argument ${(rule.match.where?.[0]?.index ?? 0) + 1} is ${rule.why.includes("concatenated") ? "concatenated or interpolated" : "not a literal"}`, ""];
296929
+ const out = [`Derived from ${finding4.ruleId}${info ? ` (${info.title})` : ""} at ${(0, import_node_path61.relative)(root, finding4.file)}:${finding4.line}`, `Rule: ${rule.id} matches ${rule.match.callee} when argument ${(rule.match.where?.[0]?.index ?? 0) + 1} is ${rule.why.includes("concatenated") ? "concatenated or interpolated" : "not a literal"}`, ""];
296601
296930
  out.push(`${preview.matches.length} similar call${preview.matches.length === 1 ? "" : "s"}:`);
296602
- for (const m of preview.matches.slice(0, 15)) out.push(` ${(0, import_node_path59.relative)(root, m.file)}:${m.line} ${m.code.slice(0, 80)}`);
296931
+ for (const m of preview.matches.slice(0, 15)) out.push(` ${(0, import_node_path61.relative)(root, m.file)}:${m.line} ${m.code.slice(0, 80)}`);
296603
296932
  if (preview.matches.length > 15) out.push(` \u2026 ${preview.matches.length - 15} more`);
296604
296933
  writeResult(out.join("\n"));
296605
296934
  if (preview.tooBroad && !opts.force) {
@@ -296614,15 +296943,73 @@ async function variantsCommand(id, opts = {}) {
296614
296943
  return 0;
296615
296944
  }
296616
296945
 
296946
+ // src/commands/keys.ts
296947
+ init_cjs_shims();
296948
+ var import_promises30 = require("readline/promises");
296949
+ var import_node_stream2 = require("stream");
296950
+ var PRESET_NAMES = ["openrouter", "deepseek", "mistral", "groq", "xai", "together"];
296951
+ function resolve15(name, opts) {
296952
+ return PRESET_NAMES.includes(name) && !opts.preset ? { name: "openai-compatible", opts: { preset: name } } : { name, opts };
296953
+ }
296954
+ function provider(name) {
296955
+ if (!PROVIDERS.includes(name)) throw new UsageError(`unknown provider "${name}" (use ${PROVIDERS.join(", ")})`);
296956
+ return name;
296957
+ }
296958
+ async function readSecret() {
296959
+ if (!process.stdin.isTTY) {
296960
+ const chunks = [];
296961
+ for await (const chunk of process.stdin) chunks.push(chunk);
296962
+ return Buffer.concat(chunks).toString("utf8").trim();
296963
+ }
296964
+ const muted = new import_node_stream2.Writable({ write: (_c, _e, done) => done() });
296965
+ process.stderr.write("Key (input is hidden): ");
296966
+ const rl = (0, import_promises30.createInterface)({ input: process.stdin, output: muted, terminal: true });
296967
+ try {
296968
+ return (await rl.question("")).trim();
296969
+ } finally {
296970
+ rl.close();
296971
+ process.stderr.write("\n");
296972
+ }
296973
+ }
296974
+ async function keysSet(rawName, rawOpts = {}) {
296975
+ const { name, opts } = resolve15(rawName, rawOpts);
296976
+ const p = provider(name);
296977
+ const key2 = await readSecret();
296978
+ if (!key2) {
296979
+ writeInfo("error: no key was given (pipe it in, or type it at the prompt)");
296980
+ return 2;
296981
+ }
296982
+ setKey(p, key2, opts.preset ? { preset: opts.preset } : {});
296983
+ writeInfo(`saved the ${p}${opts.preset ? ` (${opts.preset})` : ""} key to your private credentials file`);
296984
+ return 0;
296985
+ }
296986
+ function keysStatus() {
296987
+ const lines = ["Provider Source Key"];
296988
+ for (const p of PROVIDERS) {
296989
+ const s = keyStatus(p);
296990
+ lines.push(`${p.padEnd(19)} ${s.source.padEnd(13)} ${s.masked ?? (s.source === "sdk-default" ? "resolved by the Anthropic SDK when used" : "-")}`);
296991
+ }
296992
+ if (!credentialsFileExists()) lines.push("", "No keys are stored. Set one with: athena keys set <provider>");
296993
+ writeResult(lines.join("\n"));
296994
+ return 0;
296995
+ }
296996
+ function keysRemove(rawName, rawOpts = {}) {
296997
+ const { name, opts } = resolve15(rawName, rawOpts);
296998
+ const p = provider(name);
296999
+ const removed = removeKey(p, opts.preset ? { preset: opts.preset } : {});
297000
+ writeInfo(removed ? `removed the stored ${p} key` : `no stored ${p} key`);
297001
+ return removed ? 0 : 2;
297002
+ }
297003
+
296617
297004
  // src/commands/mcp.ts
296618
297005
  init_cjs_shims();
296619
- var import_node_path61 = require("path");
297006
+ var import_node_path63 = require("path");
296620
297007
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
296621
297008
 
296622
297009
  // src/mcp/server.ts
296623
297010
  init_cjs_shims();
296624
297011
  var import_node_fs34 = require("fs");
296625
- var import_node_path60 = require("path");
297012
+ var import_node_path62 = require("path");
296626
297013
  var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
296627
297014
  var import_zod2 = require("zod");
296628
297015
  init_dist2();
@@ -296643,19 +297030,19 @@ function createAthenaMcpServer(options) {
296643
297030
  const server2 = new import_mcp.McpServer({ name: "athena", version: CLI_VERSION });
296644
297031
  const findings = /* @__PURE__ */ new Map();
296645
297032
  const inside = (input = ".") => {
296646
- const abs = (0, import_node_path60.resolve)(root, input);
297033
+ const abs = (0, import_node_path62.resolve)(root, input);
296647
297034
  let real = abs;
296648
297035
  let probe = abs;
296649
- while (!(0, import_node_fs34.existsSync)(probe) && (0, import_node_path60.dirname)(probe) !== probe) probe = (0, import_node_path60.dirname)(probe);
297036
+ while (!(0, import_node_fs34.existsSync)(probe) && (0, import_node_path62.dirname)(probe) !== probe) probe = (0, import_node_path62.dirname)(probe);
296650
297037
  try {
296651
- real = (0, import_node_path60.resolve)((0, import_node_fs34.realpathSync)(probe), (0, import_node_path60.relative)(probe, abs));
297038
+ real = (0, import_node_path62.resolve)((0, import_node_fs34.realpathSync)(probe), (0, import_node_path62.relative)(probe, abs));
296652
297039
  } catch {
296653
297040
  throw new PathError(`cannot resolve ${input}`);
296654
297041
  }
296655
- if (real !== root && !real.startsWith(root + import_node_path60.sep)) throw new PathError(`path ${input} is outside the allowed root`);
297042
+ if (real !== root && !real.startsWith(root + import_node_path62.sep)) throw new PathError(`path ${input} is outside the allowed root`);
296656
297043
  return real;
296657
297044
  };
296658
- const rel = (p) => (0, import_node_path60.relative)(root, p).split(import_node_path60.sep).join("/") || ".";
297045
+ const rel = (p) => (0, import_node_path62.relative)(root, p).split(import_node_path62.sep).join("/") || ".";
296659
297046
  const compact = (f) => ({
296660
297047
  id: f.id.slice(0, 8),
296661
297048
  severity: f.severity,
@@ -296744,7 +297131,7 @@ function createAthenaMcpServer(options) {
296744
297131
  const texts = [];
296745
297132
  for (const f of changes.files) {
296746
297133
  if (f.status === "deleted" || f.binary) continue;
296747
- const abs = (0, import_node_path60.resolve)(root, f.path);
297134
+ const abs = (0, import_node_path62.resolve)(root, f.path);
296748
297135
  if (!(0, import_node_fs34.existsSync)(abs)) continue;
296749
297136
  if (await isSourceCandidate(abs)) candidates.push(abs);
296750
297137
  else if (isConfigTextFile(abs)) texts.push(abs);
@@ -296892,7 +297279,7 @@ function createAthenaMcpServer(options) {
296892
297279
  return ok({ skill: name, section: section ?? "Verification checklist", source: skill.source, license: skill.meta.license ?? null, text: text2.slice(0, 3200) });
296893
297280
  })
296894
297281
  );
296895
- void import_node_path60.isAbsolute;
297282
+ void import_node_path62.isAbsolute;
296896
297283
  void detectLanguage;
296897
297284
  void missingApis;
296898
297285
  return server2;
@@ -296900,43 +297287,10 @@ function createAthenaMcpServer(options) {
296900
297287
 
296901
297288
  // src/commands/mcp.ts
296902
297289
  async function mcpCommand(opts) {
296903
- const server2 = createAthenaMcpServer({ root: (0, import_node_path61.resolve)(opts.root ?? process.env.ATHENA_MCP_ROOT ?? process.cwd()) });
297290
+ const server2 = createAthenaMcpServer({ root: (0, import_node_path63.resolve)(opts.root ?? process.env.ATHENA_MCP_ROOT ?? process.cwd()) });
296904
297291
  await server2.connect(new import_stdio.StdioServerTransport());
296905
297292
  }
296906
297293
 
296907
- // src/commands/alerts.ts
296908
- init_cjs_shims();
296909
- var import_node_path62 = require("path");
296910
- var import_promises29 = require("fs/promises");
296911
- init_dist2();
296912
- async function alertsCommand(dir3 = ".") {
296913
- const given = (0, import_node_path62.resolve)(process.cwd(), dir3);
296914
- const root = (await (0, import_promises29.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path62.dirname)(given) : given;
296915
- const report = await loadLastScan(root);
296916
- if (!report) {
296917
- writeInfo(`error: no saved scan for ${root}; run athena scan first`);
296918
- return 2;
296919
- }
296920
- if (!report.inventory || report.inventory.length === 0) {
296921
- writeInfo("the last scan found no dependencies to re-check");
296922
- return 0;
296923
- }
296924
- const { alerts, missing, checked } = newAlerts(report);
296925
- if (missing.length > 0) writeInfo(`no local advisory data for ${missing.join(", ")}: run athena update --ecosystem ${missing.join(",")}`);
296926
- if (checked === 0) return 2;
296927
- if (alerts.length === 0) {
296928
- writeResult(`No new vulnerabilities since your last scan (${report.timestamp.slice(0, 10)}); ${checked} packages re-checked.`);
296929
- return 0;
296930
- }
296931
- const lines = [`${alerts.length} new vulnerabilit${alerts.length === 1 ? "y affects" : "ies affect"} ${root} since your last scan (${report.timestamp.slice(0, 10)}):`];
296932
- for (const a of alerts.sort((x, y) => x.name.localeCompare(y.name))) {
296933
- lines.push(` ${a.advisory.severity.padEnd(8)} ${a.name}@${a.version} ${a.advisory.id} ${a.advisory.summary}${a.advisory.fixed.length ? ` (fixed in ${a.advisory.fixed.sort().pop()})` : ""} ${a.manifest}`);
296934
- }
296935
- lines.push("", "Run athena scan to update the report.");
296936
- writeResult(lines.join("\n"));
296937
- return 1;
296938
- }
296939
-
296940
297294
  // src/commands/setup.ts
296941
297295
  init_cjs_shims();
296942
297296
  var import_node_child_process7 = require("child_process");