@arsh342/athena 0.4.0 → 0.4.1

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 (2) hide show
  1. package/dist/index.cjs +280 -249
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -12585,7 +12585,7 @@ function parsePom(path5, text2) {
12585
12585
  const version = /<project[^>]*>[\s\S]*?<version>\s*([^<]+?)\s*<\/version>/.exec(text2.replace(/<parent>[\s\S]*?<\/parent>/, ""))?.[1];
12586
12586
  if (version)
12587
12587
  props.set("project.version", version);
12588
- const resolve17 = (v) => v.replace(/\$\{([^}]+)\}/g, (_m, k) => props.get(k) ?? "${" + k + "}");
12588
+ const resolve18 = (v) => v.replace(/\$\{([^}]+)\}/g, (_m, k) => props.get(k) ?? "${" + k + "}");
12589
12589
  const out = [];
12590
12590
  for (const block of text2.replace(/<dependencyManagement>[\s\S]*?<\/dependencyManagement>/g, "").matchAll(/<dependency>([\s\S]*?)<\/dependency>/g)) {
12591
12591
  const g = /<groupId>\s*([^<]+?)\s*<\/groupId>/.exec(block[1])?.[1];
@@ -12593,8 +12593,8 @@ function parsePom(path5, text2) {
12593
12593
  const v = /<version>\s*([^<]+?)\s*<\/version>/.exec(block[1])?.[1];
12594
12594
  if (!g || !a)
12595
12595
  continue;
12596
- const resolved = v ? resolve17(v) : "";
12597
- out.push(dep("Maven", `${resolve17(g)}:${a}`, resolved, true, path5, lineOf(text2, `<artifactId>${a}</artifactId>`), resolved && !resolved.includes("${") ? {} : { unpinned: true }));
12596
+ const resolved = v ? resolve18(v) : "";
12597
+ out.push(dep("Maven", `${resolve18(g)}:${a}`, resolved, true, path5, lineOf(text2, `<artifactId>${a}</artifactId>`), resolved && !resolved.includes("${") ? {} : { unpinned: true }));
12598
12598
  }
12599
12599
  return out;
12600
12600
  }
@@ -13285,7 +13285,7 @@ var init_net = __esm({
13285
13285
  }
13286
13286
  async slot(fn) {
13287
13287
  if (this.active >= this.limit)
13288
- await new Promise((resolve17) => this.queue.push(resolve17));
13288
+ await new Promise((resolve18) => this.queue.push(resolve18));
13289
13289
  this.active += 1;
13290
13290
  try {
13291
13291
  return await fn();
@@ -144106,7 +144106,7 @@ ${lanes.join("\n")}
144106
144106
  }
144107
144107
  }
144108
144108
  function createImportCallExpressionAMD(arg, containsLexicalThis) {
144109
- const resolve17 = factory2.createUniqueName("resolve");
144109
+ const resolve18 = factory2.createUniqueName("resolve");
144110
144110
  const reject = factory2.createUniqueName("reject");
144111
144111
  const parameters = [
144112
144112
  factory2.createParameterDeclaration(
@@ -144115,7 +144115,7 @@ ${lanes.join("\n")}
144115
144115
  /*dotDotDotToken*/
144116
144116
  void 0,
144117
144117
  /*name*/
144118
- resolve17
144118
+ resolve18
144119
144119
  ),
144120
144120
  factory2.createParameterDeclaration(
144121
144121
  /*modifiers*/
@@ -144132,7 +144132,7 @@ ${lanes.join("\n")}
144132
144132
  factory2.createIdentifier("require"),
144133
144133
  /*typeArguments*/
144134
144134
  void 0,
144135
- [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve17, reject]
144135
+ [factory2.createArrayLiteralExpression([arg || factory2.createOmittedExpression()]), resolve18, reject]
144136
144136
  )
144137
144137
  )
144138
144138
  ]);
@@ -230850,8 +230850,8 @@ Additional information: BADCLIENT: Bad error code, ${badCode} not found in range
230850
230850
  installPackage(options) {
230851
230851
  this.packageInstallId++;
230852
230852
  const request = { kind: "installPackage", ...options, id: this.packageInstallId };
230853
- const promise = new Promise((resolve17, reject) => {
230854
- (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve17, reject });
230853
+ const promise = new Promise((resolve18, reject) => {
230854
+ (this.packageInstalledPromise ?? (this.packageInstalledPromise = /* @__PURE__ */ new Map())).set(this.packageInstallId, { resolve: resolve18, reject });
230855
230855
  });
230856
230856
  this.installer.send(request);
230857
230857
  return promise;
@@ -234110,16 +234110,16 @@ var init_sleep = __esm({
234110
234110
  "../node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs"() {
234111
234111
  "use strict";
234112
234112
  init_cjs_shims();
234113
- sleep = (ms2, signal4) => new Promise((resolve17) => {
234113
+ sleep = (ms2, signal4) => new Promise((resolve18) => {
234114
234114
  if (signal4?.aborted)
234115
- return resolve17();
234115
+ return resolve18();
234116
234116
  const onAbort = () => {
234117
234117
  clearTimeout(timer);
234118
- resolve17();
234118
+ resolve18();
234119
234119
  };
234120
234120
  const timer = setTimeout(() => {
234121
234121
  signal4?.removeEventListener("abort", onAbort);
234122
- resolve17();
234122
+ resolve18();
234123
234123
  }, ms2);
234124
234124
  signal4?.addEventListener("abort", onAbort, { once: true });
234125
234125
  });
@@ -237981,8 +237981,8 @@ var init_api_promise = __esm({
237981
237981
  APIPromise = /* @__PURE__ */ (() => {
237982
237982
  class APIPromise3 extends Promise {
237983
237983
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse) {
237984
- super((resolve17) => {
237985
- resolve17(null);
237984
+ super((resolve18) => {
237985
+ resolve18(null);
237986
237986
  });
237987
237987
  this.responsePromise = responsePromise;
237988
237988
  this.parseResponse = parseResponse2;
@@ -240950,16 +240950,16 @@ var init_async_queue = __esm({
240950
240950
  if (__classPrivateFieldGet(this, _AsyncQueue_closed, "f") || signal4?.aborted) {
240951
240951
  return Promise.resolve({ done: true, value: void 0 });
240952
240952
  }
240953
- return new Promise((resolve17) => {
240953
+ return new Promise((resolve18) => {
240954
240954
  const waiter = (r) => {
240955
240955
  signal4?.removeEventListener("abort", onAbort);
240956
- resolve17(r);
240956
+ resolve18(r);
240957
240957
  };
240958
240958
  const onAbort = () => {
240959
240959
  const idx = __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").indexOf(waiter);
240960
240960
  if (idx >= 0)
240961
240961
  __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").splice(idx, 1);
240962
- resolve17({ done: true, value: void 0 });
240962
+ resolve18({ done: true, value: void 0 });
240963
240963
  };
240964
240964
  __classPrivateFieldGet(this, _AsyncQueue_waiters, "f").push(waiter);
240965
240965
  signal4?.addEventListener("abort", onAbort, { once: true });
@@ -241764,13 +241764,13 @@ var init_json_schema = __esm({
241764
241764
 
241765
241765
  // ../node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs
241766
241766
  function promiseWithResolvers() {
241767
- let resolve17;
241767
+ let resolve18;
241768
241768
  let reject;
241769
241769
  const promise = new Promise((res, rej) => {
241770
- resolve17 = res;
241770
+ resolve18 = res;
241771
241771
  reject = rej;
241772
241772
  });
241773
- return { promise, resolve: resolve17, reject };
241773
+ return { promise, resolve: resolve18, reject };
241774
241774
  }
241775
241775
  var init_promise = __esm({
241776
241776
  "../node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs"() {
@@ -241945,18 +241945,18 @@ async function findExecutable(name, notInside = [], searchPath = readEnv("PATH")
241945
241945
  return null;
241946
241946
  }
241947
241947
  async function searchPathOutside(notInside, helpers) {
241948
- const resolve17 = (p) => fs2.realpath(p).catch(() => void 0);
241948
+ const resolve18 = (p) => fs2.realpath(p).catch(() => void 0);
241949
241949
  const isInside = async (real) => await containingRoot(notInside, real, isWithinFolded) !== void 0;
241950
241950
  let outside = null;
241951
241951
  nextEntry: for (const dir3 of absolutePathEntries(readEnv("PATH") ?? "")) {
241952
- const real = await resolve17(dir3);
241952
+ const real = await resolve18(dir3);
241953
241953
  if (await isInside(real ?? await canonicalize(dir3).catch(() => dir3)))
241954
241954
  continue;
241955
241955
  outside ?? (outside = []);
241956
241956
  if (real === void 0 || real.includes(path2.delimiter))
241957
241957
  continue;
241958
241958
  for (const name of helpers) {
241959
- const helper = await resolve17(path2.join(real, name));
241959
+ const helper = await resolve18(path2.join(real, name));
241960
241960
  if (helper !== void 0 && await isInside(helper))
241961
241961
  continue nextEntry;
241962
241962
  }
@@ -242121,7 +242121,7 @@ async function runArchiveTool(cmd, args, notInside) {
242121
242121
  const env = scrubbedShellEnv();
242122
242122
  if (searchPath !== null)
242123
242123
  env["PATH"] = searchPath;
242124
- return new Promise((resolve17, reject) => {
242124
+ return new Promise((resolve18, reject) => {
242125
242125
  const proc = child_process.spawn(file4, args, {
242126
242126
  // A link called `tar` may lead to a program that goes by the name it was started under.
242127
242127
  argv0: cmd,
@@ -242147,7 +242147,7 @@ async function runArchiveTool(cmd, args, notInside) {
242147
242147
  } else if (code !== 0) {
242148
242148
  reject(new AnthropicError(`\`${cmd}\` failed (${signal4 ?? `exit ${code}`}): ${output.stderr.trim()}`));
242149
242149
  } else {
242150
- resolve17(output.stdout);
242150
+ resolve18(output.stdout);
242151
242151
  }
242152
242152
  });
242153
242153
  });
@@ -242721,10 +242721,10 @@ async function settledOrAborted(p, signal4) {
242721
242721
  return;
242722
242722
  }
242723
242723
  let onAbort;
242724
- const aborted = new Promise((resolve17) => {
242725
- onAbort = resolve17;
242724
+ const aborted = new Promise((resolve18) => {
242725
+ onAbort = resolve18;
242726
242726
  if (signal4.aborted)
242727
- resolve17();
242727
+ resolve18();
242728
242728
  });
242729
242729
  signal4.addEventListener("abort", onAbort, { once: true });
242730
242730
  try {
@@ -243798,7 +243798,7 @@ function betaGrepTool(ctx) {
243798
243798
  });
243799
243799
  }
243800
243800
  function runRipgrep(rg, pattern, searchPath, signal4) {
243801
- return new Promise((resolve17, reject) => {
243801
+ return new Promise((resolve18, reject) => {
243802
243802
  const proc = cp.spawn(rg, ["--no-config", "-n", "--no-heading", "-e", pattern, "--", searchPath], {
243803
243803
  // A link called `rg` may lead to a program that goes by the name it was started under.
243804
243804
  argv0: "rg",
@@ -243823,12 +243823,12 @@ function runRipgrep(rg, pattern, searchPath, signal4) {
243823
243823
  if (signal4?.aborted)
243824
243824
  return reject(new ToolError("grep: aborted"));
243825
243825
  if (truncated)
243826
- return resolve17(out + `
243826
+ return resolve18(out + `
243827
243827
  [output truncated at ${GREP_OUTPUT_LIMIT} bytes]`);
243828
243828
  if (code === 0)
243829
- return resolve17(out);
243829
+ return resolve18(out);
243830
243830
  if (code === 1)
243831
- return resolve17("no matches");
243831
+ return resolve18("no matches");
243832
243832
  reject(new ToolError(`grep: rg failed: ${errOut || `exit ${code}`}`));
243833
243833
  });
243834
243834
  proc.on("error", (e) => {
@@ -244119,8 +244119,8 @@ var init_node2 = __esm({
244119
244119
  `;
244120
244120
  __classPrivateFieldGet(this, _BashSession_proc, "f").stdin.write(wrapped);
244121
244121
  if (__classPrivateFieldGet(this, _BashSession_buf, "f").indexOf(sentinel3) < 0) {
244122
- const { promise: sentinelSeen, resolve: resolve17 } = promiseWithResolvers();
244123
- __classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve: resolve17 }, "f");
244122
+ const { promise: sentinelSeen, resolve: resolve18 } = promiseWithResolvers();
244123
+ __classPrivateFieldSet(this, _BashSession_waiting, { sentinel: sentinel3, resolve: resolve18 }, "f");
244124
244124
  let timer;
244125
244125
  let onAbort;
244126
244126
  try {
@@ -244298,8 +244298,8 @@ async function withTimeout(p, ms2) {
244298
244298
  try {
244299
244299
  return await Promise.race([
244300
244300
  p.then(() => false, () => false),
244301
- new Promise((resolve17) => {
244302
- timer = setTimeout(() => resolve17(true), ms2);
244301
+ new Promise((resolve18) => {
244302
+ timer = setTimeout(() => resolve18(true), ms2);
244303
244303
  })
244304
244304
  ]);
244305
244305
  } finally {
@@ -246674,12 +246674,12 @@ var init_BetaMessageStream = __esm({
246674
246674
  }
246675
246675
  return this._emit("error", new AnthropicError(String(error)));
246676
246676
  });
246677
- __classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve17, reject) => {
246678
- __classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve17, "f");
246677
+ __classPrivateFieldSet(this, _BetaMessageStream_connectedPromise, new Promise((resolve18, reject) => {
246678
+ __classPrivateFieldSet(this, _BetaMessageStream_resolveConnectedPromise, resolve18, "f");
246679
246679
  __classPrivateFieldSet(this, _BetaMessageStream_rejectConnectedPromise, reject, "f");
246680
246680
  }), "f");
246681
- __classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve17, reject) => {
246682
- __classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve17, "f");
246681
+ __classPrivateFieldSet(this, _BetaMessageStream_endPromise, new Promise((resolve18, reject) => {
246682
+ __classPrivateFieldSet(this, _BetaMessageStream_resolveEndPromise, resolve18, "f");
246683
246683
  __classPrivateFieldSet(this, _BetaMessageStream_rejectEndPromise, reject, "f");
246684
246684
  }), "f");
246685
246685
  __classPrivateFieldGet(this, _BetaMessageStream_connectedPromise, "f").catch(() => {
@@ -246892,11 +246892,11 @@ var init_BetaMessageStream = __esm({
246892
246892
  * const message = await stream.emitted('message') // rejects if the stream errors
246893
246893
  */
246894
246894
  emitted(event) {
246895
- return new Promise((resolve17, reject) => {
246895
+ return new Promise((resolve18, reject) => {
246896
246896
  __classPrivateFieldSet(this, _BetaMessageStream_catchingPromiseCreated, true, "f");
246897
246897
  if (event !== "error")
246898
246898
  this.once("error", reject);
246899
- this.once(event, resolve17);
246899
+ this.once(event, resolve18);
246900
246900
  });
246901
246901
  }
246902
246902
  async done() {
@@ -247284,7 +247284,7 @@ var init_BetaMessageStream = __esm({
247284
247284
  if (done) {
247285
247285
  return { value: void 0, done: true };
247286
247286
  }
247287
- return new Promise((resolve17, reject) => readQueue.push({ resolve: resolve17, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
247287
+ return new Promise((resolve18, reject) => readQueue.push({ resolve: resolve18, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
247288
247288
  }
247289
247289
  const chunk = pushQueue.shift();
247290
247290
  return { value: chunk, done: false };
@@ -258843,12 +258843,12 @@ var init_MessageStream = __esm({
258843
258843
  }
258844
258844
  return this._emit("error", new AnthropicError(String(error)));
258845
258845
  });
258846
- __classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve17, reject) => {
258847
- __classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve17, "f");
258846
+ __classPrivateFieldSet(this, _MessageStream_connectedPromise, new Promise((resolve18, reject) => {
258847
+ __classPrivateFieldSet(this, _MessageStream_resolveConnectedPromise, resolve18, "f");
258848
258848
  __classPrivateFieldSet(this, _MessageStream_rejectConnectedPromise, reject, "f");
258849
258849
  }), "f");
258850
- __classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve17, reject) => {
258851
- __classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve17, "f");
258850
+ __classPrivateFieldSet(this, _MessageStream_endPromise, new Promise((resolve18, reject) => {
258851
+ __classPrivateFieldSet(this, _MessageStream_resolveEndPromise, resolve18, "f");
258852
258852
  __classPrivateFieldSet(this, _MessageStream_rejectEndPromise, reject, "f");
258853
258853
  }), "f");
258854
258854
  __classPrivateFieldGet(this, _MessageStream_connectedPromise, "f").catch(() => {
@@ -259040,11 +259040,11 @@ var init_MessageStream = __esm({
259040
259040
  * const message = await stream.emitted('message') // rejects if the stream errors
259041
259041
  */
259042
259042
  emitted(event) {
259043
- return new Promise((resolve17, reject) => {
259043
+ return new Promise((resolve18, reject) => {
259044
259044
  __classPrivateFieldSet(this, _MessageStream_catchingPromiseCreated, true, "f");
259045
259045
  if (event !== "error")
259046
259046
  this.once("error", reject);
259047
- this.once(event, resolve17);
259047
+ this.once(event, resolve18);
259048
259048
  });
259049
259049
  }
259050
259050
  async done() {
@@ -259379,7 +259379,7 @@ var init_MessageStream = __esm({
259379
259379
  if (done) {
259380
259380
  return { value: void 0, done: true };
259381
259381
  }
259382
- return new Promise((resolve17, reject) => readQueue.push({ resolve: resolve17, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
259382
+ return new Promise((resolve18, reject) => readQueue.push({ resolve: resolve18, reject })).then((chunk2) => chunk2 ? { value: chunk2, done: false } : { value: void 0, done: true });
259383
259383
  }
259384
259384
  const chunk = pushQueue.shift();
259385
259385
  return { value: chunk, done: false };
@@ -266370,7 +266370,7 @@ var init_sleep2 = __esm({
266370
266370
  "../node_modules/openai/internal/utils/sleep.mjs"() {
266371
266371
  "use strict";
266372
266372
  init_cjs_shims();
266373
- sleep2 = (ms2, ...signals) => new Promise((resolve17, reject) => {
266373
+ sleep2 = (ms2, ...signals) => new Promise((resolve18, reject) => {
266374
266374
  const activeSignals = [...new Set(signals.filter((signal4) => signal4 != null))];
266375
266375
  let timeout;
266376
266376
  let settled = false;
@@ -266402,7 +266402,7 @@ var init_sleep2 = __esm({
266402
266402
  return;
266403
266403
  }
266404
266404
  timeout = setTimeout(() => {
266405
- settle(resolve17);
266405
+ settle(resolve18);
266406
266406
  }, ms2);
266407
266407
  for (const signal4 of activeSignals) {
266408
266408
  if (settled) {
@@ -266958,8 +266958,8 @@ function createAbortableSSESource(body, signal4) {
266958
266958
  let interrupt;
266959
266959
  const waitForAbort = () => (
266960
266960
  // oxlint-disable-next-line promise/avoid-new -- AbortSignal callbacks need a portable Promise bridge.
266961
- new Promise((resolve17) => {
266962
- interrupt = resolve17;
266961
+ new Promise((resolve18) => {
266962
+ interrupt = resolve18;
266963
266963
  })
266964
266964
  );
266965
266965
  const cancel = () => {
@@ -268252,8 +268252,8 @@ var init_api_promise2 = __esm({
268252
268252
  init_parse3();
268253
268253
  APIPromise2 = class _APIPromise extends Promise {
268254
268254
  constructor(client, responsePromise, parseResponse2 = defaultParseResponse2) {
268255
- super((resolve17) => {
268256
- resolve17(null);
268255
+ super((resolve18) => {
268256
+ resolve18(null);
268257
268257
  });
268258
268258
  this.responsePromise = responsePromise;
268259
268259
  this.parseResponse = parseResponse2;
@@ -271464,12 +271464,12 @@ var init_EventStream = __esm({
271464
271464
  _EventStream_aborted.set(this, false);
271465
271465
  _EventStream_catchingPromiseCreated.set(this, false);
271466
271466
  _EventStream_terminalFailure.set(this, void 0);
271467
- __classPrivateFieldSet2(this, _EventStream_connectedPromise, new Promise((resolve17, reject) => {
271468
- __classPrivateFieldSet2(this, _EventStream_resolveConnectedPromise, resolve17, "f");
271467
+ __classPrivateFieldSet2(this, _EventStream_connectedPromise, new Promise((resolve18, reject) => {
271468
+ __classPrivateFieldSet2(this, _EventStream_resolveConnectedPromise, resolve18, "f");
271469
271469
  __classPrivateFieldSet2(this, _EventStream_rejectConnectedPromise, reject, "f");
271470
271470
  }), "f");
271471
- __classPrivateFieldSet2(this, _EventStream_endPromise, new Promise((resolve17, reject) => {
271472
- __classPrivateFieldSet2(this, _EventStream_resolveEndPromise, resolve17, "f");
271471
+ __classPrivateFieldSet2(this, _EventStream_endPromise, new Promise((resolve18, reject) => {
271472
+ __classPrivateFieldSet2(this, _EventStream_resolveEndPromise, resolve18, "f");
271473
271473
  __classPrivateFieldSet2(this, _EventStream_rejectEndPromise, reject, "f");
271474
271474
  }), "f");
271475
271475
  __classPrivateFieldGet2(this, _EventStream_connectedPromise, "f").catch(() => void 0);
@@ -271607,7 +271607,7 @@ var init_EventStream = __esm({
271607
271607
  * const message = await stream.emitted('message') // rejects if the stream errors
271608
271608
  */
271609
271609
  emitted(event) {
271610
- return new Promise((resolve17, reject) => {
271610
+ return new Promise((resolve18, reject) => {
271611
271611
  __classPrivateFieldSet2(this, _EventStream_catchingPromiseCreated, true, "f");
271612
271612
  const onError = (error) => {
271613
271613
  this.off(event, onEvent);
@@ -271617,7 +271617,7 @@ var init_EventStream = __esm({
271617
271617
  if (event !== "error") {
271618
271618
  this.off("error", onError);
271619
271619
  }
271620
- resolve17(values.length > 1 ? values : values[0]);
271620
+ resolve18(values.length > 1 ? values : values[0]);
271621
271621
  };
271622
271622
  if (event !== "error") {
271623
271623
  __classPrivateFieldGet2(this, _EventStream_instances, "m", _EventStream_onceForEmitted).call(this, "error", onError);
@@ -271833,8 +271833,8 @@ var init_EventStream = __esm({
271833
271833
  if (ended) {
271834
271834
  return Promise.resolve(doneResult());
271835
271835
  }
271836
- return new Promise((resolve17, reject) => {
271837
- readQueue.enqueue({ resolve: resolve17, reject });
271836
+ return new Promise((resolve18, reject) => {
271837
+ readQueue.enqueue({ resolve: resolve18, reject });
271838
271838
  });
271839
271839
  },
271840
271840
  return: () => {
@@ -281432,8 +281432,8 @@ var init_tool_dispatcher = __esm({
281432
281432
  try {
281433
281433
  await __classPrivateFieldGet2(this, _AgentToolDispatcher_instances, "m", _AgentToolDispatcher_wait).call(this, () => (
281434
281434
  // oxlint-disable-next-line promise/avoid-new -- Own the registration timer so cancellation clears it promptly.
281435
- new Promise((resolve17) => {
281436
- timer = setTimeout(resolve17, delay);
281435
+ new Promise((resolve18) => {
281436
+ timer = setTimeout(resolve18, delay);
281437
281437
  })
281438
281438
  ));
281439
281439
  } finally {
@@ -283432,7 +283432,7 @@ var init_steps = __esm({
283432
283432
 
283433
283433
  // ../node_modules/openai/lib/polling.mjs
283434
283434
  function sleepUntilAborted(milliseconds, signal4) {
283435
- return new Promise((resolve17, reject) => {
283435
+ return new Promise((resolve18, reject) => {
283436
283436
  let timer;
283437
283437
  let registered;
283438
283438
  let settled = false;
@@ -283481,7 +283481,7 @@ function sleepUntilAborted(milliseconds, signal4) {
283481
283481
  }
283482
283482
  settled = true;
283483
283483
  cleanup();
283484
- resolve17();
283484
+ resolve18();
283485
283485
  }, milliseconds);
283486
283486
  registered = abort;
283487
283487
  try {
@@ -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.0",
295399
+ version: "0.4.1",
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: {
@@ -295950,13 +295950,145 @@ async function initCommand(opts = {}) {
295950
295950
  init_cjs_shims();
295951
295951
  var import_node_readline = require("readline");
295952
295952
 
295953
- // src/commands/scan.ts
295953
+ // src/commands/keys.ts
295954
295954
  init_cjs_shims();
295955
- var import_promises22 = require("fs/promises");
295955
+ var import_promises22 = require("readline/promises");
295956
+ var import_node_stream2 = require("stream");
295957
+
295958
+ // ../agents/dist/light.js
295959
+ init_cjs_shims();
295960
+ init_types4();
295961
+ init_keys();
295962
+ init_pricing();
295963
+ init_usage2();
295964
+ init_consent();
295965
+
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();
295980
+ }
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");
295989
+ }
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;
295998
+ }
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" : "-")}`);
296008
+ }
296009
+ if (!credentialsFileExists()) lines.push("", "No keys are stored. Set one with: athena keys set <provider>");
296010
+ 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;
296019
+ }
296020
+
296021
+ // src/commands/review.ts
296022
+ init_cjs_shims();
296023
+ var import_promises23 = require("fs/promises");
295956
296024
  var import_node_path55 = require("path");
296025
+ init_dist2();
296026
+ 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
+ function scopeOf(flags) {
296028
+ const chosen = [flags.range ? 1 : 0, flags.base ? 1 : 0, flags.uncommitted ? 1 : 0, flags.staged ? 1 : 0].reduce((a, b) => a + b, 0);
296029
+ if (chosen > 1) throw new UsageError("choose one of --staged, --uncommitted, --range, --base");
296030
+ if (flags.range) return { kind: "range", range: flags.range };
296031
+ if (flags.base) return { kind: "base", base: flags.base };
296032
+ if (flags.uncommitted) return { kind: "uncommitted" };
296033
+ return { kind: "staged" };
296034
+ }
296035
+ async function reviewCommand(flags) {
296036
+ const cwd = process.cwd();
296037
+ const root = await getGitTopLevel(cwd);
296038
+ if (!root) {
296039
+ writeInfo("error: athena review needs a git repository");
296040
+ process.exitCode = 2;
296041
+ return;
296042
+ }
296043
+ const options = resolveRunOptions(flags, await loadProjectConfig(root), process.env, Boolean(process.stdout.isTTY));
296044
+ let diff;
296045
+ try {
296046
+ diff = await getReviewDiff(scopeOf(flags), root);
296047
+ } catch (error) {
296048
+ if (error instanceof UsageError) throw error;
296049
+ writeInfo(`error: ${error instanceof Error ? error.message.split("\n")[0] : String(error)}`);
296050
+ process.exitCode = 2;
296051
+ return;
296052
+ }
296053
+ const changes = parseUnifiedDiff(diff.diff);
296054
+ const known = new Set(changes.files.map((f) => f.path));
296055
+ for (const extra of wholeFileChanges(diff.untracked)) if (!known.has(extra.path)) changes.files.push(extra);
296056
+ const candidates = [];
296057
+ const textFiles = [];
296058
+ const excluded = [];
296059
+ for (const f of changes.files) {
296060
+ if (f.status === "deleted" || f.binary) continue;
296061
+ const abs = (0, import_node_path55.resolve)(root, f.path);
296062
+ if (!await (0, import_promises23.access)(abs).then(() => true, () => false) || !(await (0, import_promises23.stat)(abs)).isFile()) continue;
296063
+ if (isExcludedPath(abs, root, options.exclude)) {
296064
+ excluded.push(abs);
296065
+ continue;
296066
+ }
296067
+ if (await isSourceCandidate(abs)) candidates.push(abs);
296068
+ else if (isConfigTextFile(abs)) textFiles.push(abs);
296069
+ }
296070
+ const manifestChanged = changes.files.some((f) => MANIFEST2.test(f.path));
296071
+ const scoped = { ...options, deps: { ...options.deps, enabled: options.deps.enabled && manifestChanged } };
296072
+ process.exitCode = await runScan({
296073
+ mode: "review",
296074
+ root,
296075
+ target: diff.label,
296076
+ files: candidates,
296077
+ excluded,
296078
+ textFiles,
296079
+ options: scoped,
296080
+ review: { changes, scope: diff.label }
296081
+ });
296082
+ void import_node_path55.join;
296083
+ }
296084
+
296085
+ // src/commands/scan.ts
296086
+ init_cjs_shims();
296087
+ var import_promises24 = require("fs/promises");
296088
+ var import_node_path56 = require("path");
295957
296089
  async function scanCommand(dir3, flags) {
295958
- const given = (0, import_node_path55.resolve)(process.cwd(), dir3);
295959
- const root = (await (0, import_promises22.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path55.dirname)(given) : given;
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;
295960
296092
  const options = resolveRunOptions(flags, await loadProjectConfig(root), process.env, Boolean(process.stdout.isTTY));
295961
296093
  const { files, excluded, textFiles } = await findSourceFilesWithExclusions(given, options.exclude);
295962
296094
  process.exitCode = await runScan({ mode: "scan", root, target: dir3, files, excluded, textFiles, options });
@@ -295964,9 +296096,9 @@ async function scanCommand(dir3, flags) {
295964
296096
 
295965
296097
  // src/commands/uninstall.ts
295966
296098
  init_cjs_shims();
295967
- var import_promises23 = require("fs/promises");
296099
+ var import_promises25 = require("fs/promises");
295968
296100
  var import_node_fs33 = require("fs");
295969
- var import_node_path56 = require("path");
296101
+ var import_node_path57 = require("path");
295970
296102
  async function uninstallCommand() {
295971
296103
  const root = await getGitRoot();
295972
296104
  const hooksDir = await getGitHooksDir();
@@ -295977,9 +296109,9 @@ async function uninstallCommand() {
295977
296109
  }
295978
296110
  let removed = 0;
295979
296111
  for (const name of ["pre-commit", "pre-push"]) {
295980
- const path5 = (0, import_node_path56.join)(root, hooksDir, name);
296112
+ const path5 = (0, import_node_path57.join)(root, hooksDir, name);
295981
296113
  if ((0, import_node_fs33.existsSync)(path5) && isAthenaHook(path5)) {
295982
- await (0, import_promises23.rm)(path5, { force: true });
296114
+ await (0, import_promises25.rm)(path5, { force: true });
295983
296115
  console.log(`Athena ${name} hook removed from ${path5}`);
295984
296116
  removed += 1;
295985
296117
  } else if ((0, import_node_fs33.existsSync)(path5)) console.log(`${path5} is not Athena's; left unchanged`);
@@ -296035,42 +296167,67 @@ async function menuCommand(program3) {
296035
296167
  const items = [
296036
296168
  {
296037
296169
  label: "Scan current directory",
296038
- desc: "Run full recursive JS/TS scan from cwd.",
296170
+ desc: "Scan every supported language from here (add --ai for verification).",
296039
296171
  command: "athena scan .",
296040
- detail: "Parse code units, score AI provenance, run targeted security checks, print report.",
296172
+ detail: "Offline: parses code, traces tainted data, finds secrets and risky dependencies, estimates AI provenance, prints a report.",
296041
296173
  run: () => scanCommand(".", { format: "terminal" })
296042
296174
  },
296175
+ {
296176
+ label: "Review my changes",
296177
+ desc: "Review staged changes and report only what they introduced.",
296178
+ command: "athena review",
296179
+ detail: "Like a code review before you commit. Also: --uncommitted, --range origin/main..HEAD, --base main, --format markdown.",
296180
+ run: () => reviewCommand({ format: "terminal" })
296181
+ },
296043
296182
  {
296044
296183
  label: "Check staged files",
296045
- desc: "Scan staged JS/TS files, same path used by pre-commit hook.",
296184
+ desc: "Fast gate for the commit flow (what the pre-commit hook runs).",
296046
296185
  command: "athena check",
296047
- detail: "Fast gate for commit flow. Reads git staged files and exits 1 on blocking risk.",
296186
+ detail: "Scans staged files and exits 1 when a finding reaches your --fail-on level.",
296048
296187
  run: () => checkCommand([], { format: "terminal" })
296049
296188
  },
296050
296189
  {
296051
- label: "Install pre-commit hook",
296052
- desc: "Create .git/hooks/pre-commit and run athena check before commit.",
296190
+ label: "Install git hooks",
296191
+ desc: "Add a pre-commit gate (pre-push with --hooks pre-commit,pre-push).",
296053
296192
  command: "athena init",
296054
- detail: "Installs local hook in current git repo. Future commits run Athena before write.",
296055
- run: initCommand
296193
+ detail: "Respects Husky, lefthook and core.hooksPath. Skip once with ATHENA_SKIP=1.",
296194
+ run: () => initCommand()
296056
296195
  },
296057
296196
  {
296058
- label: "Remove pre-commit hook",
296059
- desc: "Delete Athena pre-commit hook.",
296197
+ label: "Update advisory data",
296198
+ desc: "Refresh the local vulnerability database, KEV and EPSS.",
296199
+ command: "athena update",
296200
+ detail: "Dependency checks then work offline. Use athena alerts to see new advisories for your lockfiles.",
296201
+ run: async () => {
296202
+ process.exitCode = await updateCommand();
296203
+ }
296204
+ },
296205
+ {
296206
+ label: "AI keys",
296207
+ desc: "See which AI provider keys Athena can use (optional layer).",
296208
+ command: "athena keys status",
296209
+ detail: "Set one with: athena keys set anthropic | openai | google | groq. Keys are stored privately; spend is capped per run and per day.",
296210
+ run: () => {
296211
+ process.exitCode = keysStatus();
296212
+ }
296213
+ },
296214
+ {
296215
+ label: "Remove git hooks",
296216
+ desc: "Delete Athena's git hooks.",
296060
296217
  command: "athena uninstall",
296061
- detail: "Removes Athena hook file from .git/hooks/pre-commit.",
296218
+ detail: "Removes the hooks Athena installed. Your own hooks are left alone.",
296062
296219
  run: uninstallCommand
296063
296220
  },
296064
296221
  {
296065
296222
  label: "Show help",
296066
- desc: "Print CLI commands and options.",
296223
+ desc: "Print every command and option.",
296067
296224
  command: "athena --help",
296068
- detail: "Shows all commands, flags, and command descriptions.",
296225
+ detail: "Includes mcp (agent toolbox), skills, provenance, models and explain.",
296069
296226
  run: () => program3.outputHelp()
296070
296227
  },
296071
296228
  {
296072
- label: "Doctor toolchain",
296073
- desc: "Check node, npm, git and ESLint availability.",
296229
+ label: "Doctor",
296230
+ desc: "Check node, git and optional tools.",
296074
296231
  command: "athena doctor",
296075
296232
  detail: "Useful for debugging a missing toolchain.",
296076
296233
  run: doctorCommand
@@ -296112,7 +296269,7 @@ async function select(items) {
296112
296269
  process.stdin.resume();
296113
296270
  let index = 0;
296114
296271
  render2(items, index, historyText);
296115
- return new Promise((resolve17) => {
296272
+ return new Promise((resolve18) => {
296116
296273
  const cleanup = () => {
296117
296274
  process.stdin.setRawMode(false);
296118
296275
  process.stdin.pause();
@@ -296120,7 +296277,7 @@ async function select(items) {
296120
296277
  };
296121
296278
  const done = (value) => {
296122
296279
  cleanup();
296123
- resolve17(value);
296280
+ resolve18(value);
296124
296281
  };
296125
296282
  const onKeypress = (_input, key2) => {
296126
296283
  if (key2.ctrl && key2.name === "c") done(null);
@@ -296135,7 +296292,7 @@ async function select(items) {
296135
296292
  }
296136
296293
  if (key2.name === "return") done(index);
296137
296294
  const number = Number(key2.sequence);
296138
- if (Number.isInteger(number) && number >= 1 && number <= items.length) {
296295
+ if (Number.isInteger(number) && number >= 1 && number <= Math.min(9, items.length)) {
296139
296296
  done(number - 1);
296140
296297
  }
296141
296298
  };
@@ -296148,12 +296305,12 @@ function render2(items, selected, historyText) {
296148
296305
  const selectedItem = items[selected];
296149
296306
  printBanner();
296150
296307
  console.log("");
296151
- console.log(` ${c.dim}AI code provenance tracker${c.reset}${pad(cols - 40)}${c.accent}v${CLI_VERSION}${c.reset}`);
296308
+ console.log(` ${c.dim}Security review for AI-assisted code${c.reset}${pad(cols - 40)}${c.accent}v${CLI_VERSION}${c.reset}`);
296152
296309
  console.log(` ${c.dim}${truncate(process.cwd(), cols - 4)}${c.reset}`);
296153
296310
  console.log("");
296154
296311
  console.log(` ${dashedLine(cols - 4)}`);
296155
296312
  console.log("");
296156
- console.log(` ${c.dim}\u2191/\u2193${c.reset} navigate ${c.dim}enter${c.reset} run ${c.dim}1-${items.length}${c.reset} jump ${c.dim}q${c.reset} quit`);
296313
+ 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`);
296157
296314
  console.log(` ${c.dim}${truncate(historyText, cols - 4)}${c.reset}`);
296158
296315
  console.log("");
296159
296316
  for (let i = 0; i < items.length; i++) {
@@ -296192,7 +296349,7 @@ async function waitForReturnToMenu() {
296192
296349
  (0, import_node_readline.emitKeypressEvents)(process.stdin);
296193
296350
  process.stdin.setRawMode(true);
296194
296351
  process.stdin.resume();
296195
- await new Promise((resolve17) => {
296352
+ await new Promise((resolve18) => {
296196
296353
  const cleanup = () => {
296197
296354
  process.stdin.setRawMode(false);
296198
296355
  process.stdin.pause();
@@ -296200,7 +296357,7 @@ async function waitForReturnToMenu() {
296200
296357
  };
296201
296358
  const onKeypress = () => {
296202
296359
  cleanup();
296203
- resolve17();
296360
+ resolve18();
296204
296361
  };
296205
296362
  process.stdin.on("keypress", onKeypress);
296206
296363
  });
@@ -296208,13 +296365,13 @@ async function waitForReturnToMenu() {
296208
296365
 
296209
296366
  // src/commands/skills.ts
296210
296367
  init_cjs_shims();
296211
- var import_promises24 = require("fs/promises");
296212
- var import_promises25 = require("readline/promises");
296213
- var import_node_path57 = require("path");
296368
+ var import_promises26 = require("fs/promises");
296369
+ var import_promises27 = require("readline/promises");
296370
+ var import_node_path58 = require("path");
296214
296371
  init_dist2();
296215
296372
  async function rootOf(path5) {
296216
- const given = (0, import_node_path57.resolve)(process.cwd(), path5 ?? ".");
296217
- return (await (0, import_promises24.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path57.dirname)(given) : given;
296373
+ const given = (0, import_node_path58.resolve)(process.cwd(), path5 ?? ".");
296374
+ return (await (0, import_promises26.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path58.dirname)(given) : given;
296218
296375
  }
296219
296376
  async function projectProfile(root) {
296220
296377
  const { files, textFiles } = await findSourceFilesWithExclusions(root, ["node_modules", "dist", "build"]);
@@ -296223,8 +296380,8 @@ async function projectProfile(root) {
296223
296380
  const lang = detectLanguage(path5, "");
296224
296381
  if (!lang) continue;
296225
296382
  try {
296226
- const source = await (0, import_promises24.readFile)(path5, "utf8");
296227
- if (isVendoredOrGenerated((0, import_node_path57.relative)(root, path5).split("\\").join("/"), source)) continue;
296383
+ const source = await (0, import_promises26.readFile)(path5, "utf8");
296384
+ if (isVendoredOrGenerated((0, import_node_path58.relative)(root, path5).split("\\").join("/"), source)) continue;
296228
296385
  sources.push({ path: path5, source, lang });
296229
296386
  } catch {
296230
296387
  }
@@ -296282,7 +296439,7 @@ async function skillsShow(name, opts) {
296282
296439
  }
296283
296440
  async function confirm(question) {
296284
296441
  if (!process.stdin.isTTY) return false;
296285
- const rl = (0, import_promises25.createInterface)({ input: process.stdin, output: process.stderr });
296442
+ const rl = (0, import_promises27.createInterface)({ input: process.stdin, output: process.stderr });
296286
296443
  try {
296287
296444
  return /^y(es)?$/i.test((await rl.question(`${question} [y/N] `)).trim());
296288
296445
  } finally {
@@ -296329,7 +296486,7 @@ ${c2.selfTest.failures.slice(0, 5).map((f) => ` ${f}`).join("\n")}`);
296329
296486
  writeInfo("not installed (re-run with --yes to confirm)");
296330
296487
  return 2;
296331
296488
  }
296332
- const target = opts.repo ? (0, import_node_path57.join)(root, ".athena", "skills") : userSkillsDir();
296489
+ const target = opts.repo ? (0, import_node_path58.join)(root, ".athena", "skills") : userSkillsDir();
296333
296490
  const replacing = approved.filter((c2) => isInstalled(c2.skill.meta.name, target)).map((c2) => c2.skill.meta.name);
296334
296491
  if (replacing.length > 0 && !opts.yes && !await confirm(`${replacing.join(", ")} already installed in ${target}. Replace?`)) {
296335
296492
  writeInfo("not installed (existing skill kept)");
@@ -296343,7 +296500,7 @@ ${c2.selfTest.failures.slice(0, 5).map((f) => ` ${f}`).join("\n")}`);
296343
296500
  }
296344
296501
  async function skillsRemove(name, opts) {
296345
296502
  const root = await rootOf(opts.path);
296346
- const target = opts.repo ? (0, import_node_path57.join)(root, ".athena", "skills") : userSkillsDir();
296503
+ const target = opts.repo ? (0, import_node_path58.join)(root, ".athena", "skills") : userSkillsDir();
296347
296504
  if (!removeSkill(name, target)) {
296348
296505
  writeInfo(`error: no installed skill "${name}" in ${target}`);
296349
296506
  return 2;
@@ -296354,15 +296511,15 @@ async function skillsRemove(name, opts) {
296354
296511
  async function skillsNew(name, opts) {
296355
296512
  const root = await rootOf(opts.path);
296356
296513
  try {
296357
- writeInfo(`created ${scaffoldSkill(name, opts.user ? userSkillsDir() : (0, import_node_path57.join)(root, ".athena", "skills"))} (edit it, then run athena skills test)`);
296514
+ writeInfo(`created ${scaffoldSkill(name, opts.user ? userSkillsDir() : (0, import_node_path58.join)(root, ".athena", "skills"))} (edit it, then run athena skills test)`);
296358
296515
  return 0;
296359
296516
  } catch (error) {
296360
296517
  throw new UsageError(error instanceof Error ? error.message : String(error));
296361
296518
  }
296362
296519
  }
296363
296520
  async function skillsTest(path5) {
296364
- const target = (0, import_node_path57.resolve)(process.cwd(), path5 ?? ".");
296365
- const dirs = await (0, import_promises24.stat)((0, import_node_path57.join)(target, "SKILL.md")).catch(() => null) ? [target] : await findChildSkillDirs(target);
296521
+ const target = (0, import_node_path58.resolve)(process.cwd(), path5 ?? ".");
296522
+ const dirs = await (0, import_promises26.stat)((0, import_node_path58.join)(target, "SKILL.md")).catch(() => null) ? [target] : await findChildSkillDirs(target);
296366
296523
  if (dirs.length === 0) {
296367
296524
  writeInfo(`error: no SKILL.md in ${target}`);
296368
296525
  return 2;
@@ -296387,23 +296544,23 @@ async function findChildSkillDirs(dir3) {
296387
296544
  const { readdir: readdir4 } = await import("fs/promises");
296388
296545
  const out = [];
296389
296546
  for (const entry of await readdir4(dir3, { withFileTypes: true }).catch(() => [])) {
296390
- if (entry.isDirectory() && await (0, import_promises24.stat)((0, import_node_path57.join)(dir3, entry.name, "SKILL.md")).catch(() => null)) out.push((0, import_node_path57.join)(dir3, entry.name));
296547
+ 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));
296391
296548
  }
296392
296549
  return out.sort();
296393
296550
  }
296394
296551
 
296395
296552
  // src/commands/variants.ts
296396
296553
  init_cjs_shims();
296397
- var import_promises26 = require("fs/promises");
296398
- var import_node_path58 = require("path");
296554
+ var import_promises28 = require("fs/promises");
296555
+ var import_node_path59 = require("path");
296399
296556
  init_dist2();
296400
296557
  async function variantsCommand(id, opts = {}) {
296401
296558
  const fail2 = (message) => {
296402
296559
  writeInfo(`error: ${message}`);
296403
296560
  return 2;
296404
296561
  };
296405
- const given = (0, import_node_path58.resolve)(process.cwd(), opts.path ?? ".");
296406
- const root = (await (0, import_promises26.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path58.dirname)(given) : given;
296562
+ const given = (0, import_node_path59.resolve)(process.cwd(), opts.path ?? ".");
296563
+ const root = (await (0, import_promises28.stat)(given).catch(() => null))?.isFile() ? (0, import_node_path59.dirname)(given) : given;
296407
296564
  if (id.length < 4) return fail2("finding id must have at least 4 characters");
296408
296565
  const report = await loadLastScan(root);
296409
296566
  if (!report) return fail2(`no saved scan for ${root}; run athena scan first`);
@@ -296413,20 +296570,20 @@ async function variantsCommand(id, opts = {}) {
296413
296570
  const finding4 = found[0];
296414
296571
  const lang = detectLanguage(finding4.file, "");
296415
296572
  if (!lang) return fail2("unsupported language");
296416
- const source = await (0, import_promises26.readFile)(finding4.file, "utf8");
296573
+ const source = await (0, import_promises28.readFile)(finding4.file, "utf8");
296417
296574
  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);
296418
296575
  if (!rule) return fail2("this finding is not a call to a function, so it cannot be generalised into a rule");
296419
296576
  const { files } = await findSourceFilesWithExclusions(root, ["node_modules", "dist", "build"]);
296420
296577
  const project = [];
296421
296578
  for (const path5 of files) {
296422
296579
  const l = detectLanguage(path5, "");
296423
- if (l) project.push({ path: path5, source: await (0, import_promises26.readFile)(path5, "utf8").catch(() => ""), lang: l });
296580
+ if (l) project.push({ path: path5, source: await (0, import_promises28.readFile)(path5, "utf8").catch(() => ""), lang: l });
296424
296581
  }
296425
296582
  const preview = await previewVariant(rule, project, root, { ruleId: finding4.ruleId, file: finding4.file, line: finding4.line, code: finding4.code });
296426
296583
  const info = getRuleInfo(finding4.ruleId);
296427
- const out = [`Derived from ${finding4.ruleId}${info ? ` (${info.title})` : ""} at ${(0, import_node_path58.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"}`, ""];
296584
+ 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"}`, ""];
296428
296585
  out.push(`${preview.matches.length} similar call${preview.matches.length === 1 ? "" : "s"}:`);
296429
- for (const m of preview.matches.slice(0, 15)) out.push(` ${(0, import_node_path58.relative)(root, m.file)}:${m.line} ${m.code.slice(0, 80)}`);
296586
+ 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)}`);
296430
296587
  if (preview.matches.length > 15) out.push(` \u2026 ${preview.matches.length - 15} more`);
296431
296588
  writeResult(out.join("\n"));
296432
296589
  if (preview.tooBroad && !opts.force) {
@@ -296441,132 +296598,6 @@ async function variantsCommand(id, opts = {}) {
296441
296598
  return 0;
296442
296599
  }
296443
296600
 
296444
- // src/commands/review.ts
296445
- init_cjs_shims();
296446
- var import_promises27 = require("fs/promises");
296447
- var import_node_path59 = require("path");
296448
- init_dist2();
296449
- 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)$/;
296450
- function scopeOf(flags) {
296451
- const chosen = [flags.range ? 1 : 0, flags.base ? 1 : 0, flags.uncommitted ? 1 : 0, flags.staged ? 1 : 0].reduce((a, b) => a + b, 0);
296452
- if (chosen > 1) throw new UsageError("choose one of --staged, --uncommitted, --range, --base");
296453
- if (flags.range) return { kind: "range", range: flags.range };
296454
- if (flags.base) return { kind: "base", base: flags.base };
296455
- if (flags.uncommitted) return { kind: "uncommitted" };
296456
- return { kind: "staged" };
296457
- }
296458
- async function reviewCommand(flags) {
296459
- const cwd = process.cwd();
296460
- const root = await getGitTopLevel(cwd);
296461
- if (!root) {
296462
- writeInfo("error: athena review needs a git repository");
296463
- process.exitCode = 2;
296464
- return;
296465
- }
296466
- const options = resolveRunOptions(flags, await loadProjectConfig(root), process.env, Boolean(process.stdout.isTTY));
296467
- let diff;
296468
- try {
296469
- diff = await getReviewDiff(scopeOf(flags), root);
296470
- } catch (error) {
296471
- if (error instanceof UsageError) throw error;
296472
- writeInfo(`error: ${error instanceof Error ? error.message.split("\n")[0] : String(error)}`);
296473
- process.exitCode = 2;
296474
- return;
296475
- }
296476
- const changes = parseUnifiedDiff(diff.diff);
296477
- const known = new Set(changes.files.map((f) => f.path));
296478
- for (const extra of wholeFileChanges(diff.untracked)) if (!known.has(extra.path)) changes.files.push(extra);
296479
- const candidates = [];
296480
- const textFiles = [];
296481
- const excluded = [];
296482
- for (const f of changes.files) {
296483
- if (f.status === "deleted" || f.binary) continue;
296484
- const abs = (0, import_node_path59.resolve)(root, f.path);
296485
- if (!await (0, import_promises27.access)(abs).then(() => true, () => false) || !(await (0, import_promises27.stat)(abs)).isFile()) continue;
296486
- if (isExcludedPath(abs, root, options.exclude)) {
296487
- excluded.push(abs);
296488
- continue;
296489
- }
296490
- if (await isSourceCandidate(abs)) candidates.push(abs);
296491
- else if (isConfigTextFile(abs)) textFiles.push(abs);
296492
- }
296493
- const manifestChanged = changes.files.some((f) => MANIFEST2.test(f.path));
296494
- const scoped = { ...options, deps: { ...options.deps, enabled: options.deps.enabled && manifestChanged } };
296495
- process.exitCode = await runScan({
296496
- mode: "review",
296497
- root,
296498
- target: diff.label,
296499
- files: candidates,
296500
- excluded,
296501
- textFiles,
296502
- options: scoped,
296503
- review: { changes, scope: diff.label }
296504
- });
296505
- void import_node_path59.join;
296506
- }
296507
-
296508
- // src/commands/keys.ts
296509
- init_cjs_shims();
296510
- var import_promises28 = require("readline/promises");
296511
- var import_node_stream2 = require("stream");
296512
-
296513
- // ../agents/dist/light.js
296514
- init_cjs_shims();
296515
- init_types4();
296516
- init_keys();
296517
- init_pricing();
296518
- init_usage2();
296519
- init_consent();
296520
-
296521
- // src/commands/keys.ts
296522
- function provider(name) {
296523
- if (!PROVIDERS.includes(name)) throw new UsageError(`unknown provider "${name}" (use ${PROVIDERS.join(", ")})`);
296524
- return name;
296525
- }
296526
- async function readSecret() {
296527
- if (!process.stdin.isTTY) {
296528
- const chunks = [];
296529
- for await (const chunk of process.stdin) chunks.push(chunk);
296530
- return Buffer.concat(chunks).toString("utf8").trim();
296531
- }
296532
- const muted = new import_node_stream2.Writable({ write: (_c, _e, done) => done() });
296533
- process.stderr.write("Key (input is hidden): ");
296534
- const rl = (0, import_promises28.createInterface)({ input: process.stdin, output: muted, terminal: true });
296535
- try {
296536
- return (await rl.question("")).trim();
296537
- } finally {
296538
- rl.close();
296539
- process.stderr.write("\n");
296540
- }
296541
- }
296542
- async function keysSet(name, opts = {}) {
296543
- const p = provider(name);
296544
- const key2 = await readSecret();
296545
- if (!key2) {
296546
- writeInfo("error: no key was given (pipe it in, or type it at the prompt)");
296547
- return 2;
296548
- }
296549
- setKey(p, key2, opts.preset ? { preset: opts.preset } : {});
296550
- writeInfo(`saved the ${p}${opts.preset ? ` (${opts.preset})` : ""} key to your private credentials file`);
296551
- return 0;
296552
- }
296553
- function keysStatus() {
296554
- const lines = ["Provider Source Key"];
296555
- for (const p of PROVIDERS) {
296556
- const s = keyStatus(p);
296557
- lines.push(`${p.padEnd(19)} ${s.source.padEnd(13)} ${s.masked ?? (s.source === "sdk-default" ? "resolved by the Anthropic SDK when used" : "-")}`);
296558
- }
296559
- if (!credentialsFileExists()) lines.push("", "No keys are stored. Set one with: athena keys set <provider>");
296560
- writeResult(lines.join("\n"));
296561
- return 0;
296562
- }
296563
- function keysRemove(name, opts = {}) {
296564
- const p = provider(name);
296565
- const removed = removeKey(p, opts.preset ? { preset: opts.preset } : {});
296566
- writeInfo(removed ? `removed the stored ${p} key` : `no stored ${p} key`);
296567
- return removed ? 0 : 2;
296568
- }
296569
-
296570
296601
  // src/commands/mcp.ts
296571
296602
  init_cjs_shims();
296572
296603
  var import_node_path61 = require("path");
@@ -296945,7 +296976,7 @@ Installing ${tool.name}...`);
296945
296976
 
296946
296977
  // src/index.ts
296947
296978
  var program2 = new Command();
296948
- program2.name("athena").description("AI code provenance tracker and security scanner for JavaScript and TypeScript").version(CLI_VERSION).exitOverride();
296979
+ program2.name("athena").description("security review for AI-assisted code: offline scanning, change review, git gates and an MCP toolbox").version(CLI_VERSION).exitOverride();
296949
296980
  function addRunFlags(command) {
296950
296981
  return command.option("-f, --format <format>", "terminal | json | jsonl | sarif | markdown | cyclonedx (SBOM)", "terminal").option("-o, --output <file>", "write the report to a file instead of stdout").option("--fail-on <level>", "block on findings at or above: critical | high | medium | low | none (default: high)").option("--strict", "exit 3 when the scan was incomplete (files or checks skipped)").option("-q, --quiet", "no progress output").option("-v, --verbose", "also print scanner notes").option("--no-color", "disable colour").option("-m, --max-findings <number|all>", "max findings to print (default: all)").option("--show-low", "list LOW findings instead of collapsing them").option("-t, --threshold <number>", "deprecated: only affects the heuristic fallback").option("--no-eslint", "disable ESLint scanner").option("--no-learning", "do not learn from, or apply learning of, this repository's trusted labels").option("--no-npm-audit", "deprecated no-op: npm audit was replaced by dependency checks").option("--ai [mode]", "AI layer: verify (default) settles uncertain findings, hunt also explores risky components, deep adds a panel (needs --budget); spend is capped").option("--provider <name>", "AI provider: anthropic (default), openai, google, openai-compatible").option("--model <id>", "AI model (Anthropic default: claude-sonnet-5-5)").option("--quality <level>", "economy (Haiku 5.5) or high (Opus 5.5); default balanced (Sonnet 5.5)").option("--budget <usd>", "cap this AI run at this many dollars (default 0.25; day cap 1.00)").option("--budget-tokens <n>", "cap this AI run at this many tokens (for models without a known price)").option("--base-url <url>", "endpoint for openai-compatible (https, or localhost)").option("--preset <name>", "openai-compatible preset: openrouter, deepseek, mistral, groq, xai, together, ollama, lmstudio").option("--suggest-fixes", "with --ai deep: write reviewed patch suggestions to .athena/patches (never applied)").option("-y, --yes", "agree to send code excerpts to the AI provider without asking").option("--no-deps", "skip dependency checks (vulnerabilities, missing and typosquatted packages)").option("--offline", "dependency checks use only cached data").option("--no-nodejsscan", "deprecated no-op: NodeJSScan was retired").option("--no-bearer", "deprecated no-op: Bearer was retired").option("--no-semgrep", "deprecated no-op: Semgrep was retired");
296951
296982
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arsh342/athena",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "AI code provenance tracker and terminal scanner for JavaScript/TypeScript, Python, Java, C#, C/C++, Go, Rust, PHP and Shell repositories.",
5
5
  "type": "module",
6
6
  "bin": {