aislop 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2760,7 +2760,7 @@ const RISKY_PATTERNS = [
2760
2760
  help: "Avoid dynamic code execution — refactor to use static code paths"
2761
2761
  },
2762
2762
  {
2763
- pattern: /\.innerHTML\s*=/g,
2763
+ pattern: new RegExp(`\\.innerHTML\\s*=`, "g"),
2764
2764
  extensions: [
2765
2765
  ".ts",
2766
2766
  ".tsx",
@@ -2857,6 +2857,10 @@ const detectRiskyConstructs = async (context) => {
2857
2857
  let match;
2858
2858
  while ((match = regex.exec(content)) !== null) {
2859
2859
  const line = content.slice(0, match.index).split("\n").length;
2860
+ if (name === "innerhtml") {
2861
+ const beforeMatch = content.slice(Math.max(0, match.index - 200), match.index);
2862
+ if (/(?:template|tmpl|tpl)$/i.test(beforeMatch.trimEnd()) || /createElement\s*\(\s*['"]template['"]\s*\)$/.test(beforeMatch.trimEnd())) continue;
2863
+ }
2860
2864
  if (name === "sql-injection") {
2861
2865
  const afterMatch = content.slice(match.index + match[0].length, match.index + match[0].length + 100);
2862
2866
  if (/^(?:\w+\.join\s*\(|[A-Z_]+\}|tableName\}|table\})/.test(afterMatch)) continue;
@@ -3114,7 +3118,7 @@ const logger = {
3114
3118
  * Application version — injected at build time by tsdown from package.json.
3115
3119
  * The fallback should always match the "version" field in package.json.
3116
3120
  */
3117
- const APP_VERSION = "0.1.1";
3121
+ const APP_VERSION = "0.1.2";
3118
3122
 
3119
3123
  //#endregion
3120
3124
  //#region src/output/layout.ts
@@ -3768,7 +3772,7 @@ const scanCommand = async (directory, config, options) => {
3768
3772
  const allDiagnostics = results.flatMap((r) => r.diagnostics);
3769
3773
  const elapsedMs = performance.now() - startTime;
3770
3774
  const scoreResult = calculateScore(allDiagnostics, config.scoring.weights, config.scoring.thresholds);
3771
- const exitCode = scoreResult.score < config.ci.failBelow ? 1 : 0;
3775
+ const exitCode = allDiagnostics.some((d) => d.severity === "error") || scoreResult.score < config.ci.failBelow ? 1 : 0;
3772
3776
  if (!isTelemetryDisabled(config.telemetry?.enabled)) {
3773
3777
  const engineIssues = {};
3774
3778
  const engineTimings = {};
@@ -3,7 +3,7 @@
3
3
  * Application version — injected at build time by tsdown from package.json.
4
4
  * The fallback should always match the "version" field in package.json.
5
5
  */
6
- const APP_VERSION = "0.1.1";
6
+ const APP_VERSION = "0.1.2";
7
7
 
8
8
  //#endregion
9
9
  //#region src/output/engine-info.ts
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as getEngineLabel, r as APP_VERSION, t as ENGINE_INFO } from "./engine-info-Bw_OOj3G.js";
1
+ import { n as getEngineLabel, r as APP_VERSION, t as ENGINE_INFO } from "./engine-info-B4Eq4giL.js";
2
2
  import { n as runSubprocess, t as isToolInstalled } from "./subprocess-99puEEGl.js";
3
3
  import { createRequire } from "node:module";
4
4
  import fs from "node:fs";
@@ -3358,7 +3358,7 @@ const RISKY_PATTERNS = [
3358
3358
  help: "Avoid dynamic code execution — refactor to use static code paths"
3359
3359
  },
3360
3360
  {
3361
- pattern: /\.innerHTML\s*=/g,
3361
+ pattern: new RegExp(`\\.innerHTML\\s*=`, "g"),
3362
3362
  extensions: [
3363
3363
  ".ts",
3364
3364
  ".tsx",
@@ -3455,6 +3455,10 @@ const detectRiskyConstructs = async (context) => {
3455
3455
  let match;
3456
3456
  while ((match = regex.exec(content)) !== null) {
3457
3457
  const line = content.slice(0, match.index).split("\n").length;
3458
+ if (name === "innerhtml") {
3459
+ const beforeMatch = content.slice(Math.max(0, match.index - 200), match.index);
3460
+ if (/(?:template|tmpl|tpl)$/i.test(beforeMatch.trimEnd()) || /createElement\s*\(\s*['"]template['"]\s*\)$/.test(beforeMatch.trimEnd())) continue;
3461
+ }
3458
3462
  if (name === "sql-injection") {
3459
3463
  const afterMatch = content.slice(match.index + match[0].length, match.index + match[0].length + 100);
3460
3464
  if (/^(?:\w+\.join\s*\(|[A-Z_]+\}|tableName\}|table\})/.test(afterMatch)) continue;
@@ -3968,7 +3972,7 @@ const scanCommand = async (directory, config, options) => {
3968
3972
  const allDiagnostics = results.flatMap((r) => r.diagnostics);
3969
3973
  const elapsedMs = performance.now() - startTime;
3970
3974
  const scoreResult = calculateScore(allDiagnostics, config.scoring.weights, config.scoring.thresholds);
3971
- const exitCode = scoreResult.score < config.ci.failBelow ? 1 : 0;
3975
+ const exitCode = allDiagnostics.some((d) => d.severity === "error") || scoreResult.score < config.ci.failBelow ? 1 : 0;
3972
3976
  if (!isTelemetryDisabled(config.telemetry?.enabled)) {
3973
3977
  const engineIssues = {};
3974
3978
  const engineTimings = {};
@@ -3987,7 +3991,7 @@ const scanCommand = async (directory, config, options) => {
3987
3991
  });
3988
3992
  }
3989
3993
  if (options.json) {
3990
- const { buildJsonOutput } = await import("./json-SHDiefXX.js");
3994
+ const { buildJsonOutput } = await import("./json-BMSa_G7o.js");
3991
3995
  const jsonOut = buildJsonOutput(results, scoreResult, projectInfo.sourceFileCount, elapsedMs);
3992
3996
  console.log(JSON.stringify(jsonOut, null, 2));
3993
3997
  return { exitCode };
@@ -1,4 +1,4 @@
1
- import { r as APP_VERSION, t as ENGINE_INFO } from "./engine-info-Bw_OOj3G.js";
1
+ import { r as APP_VERSION, t as ENGINE_INFO } from "./engine-info-B4Eq4giL.js";
2
2
 
3
3
  //#region src/output/json.ts
4
4
  const buildJsonOutput = (results, scoreResult, fileCount, elapsedMs) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aislop",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Stop AI slop from shipping. A unified code quality CLI that catches the lazy patterns AI coding tools leave behind.",
5
5
  "type": "module",
6
6
  "bin": {