aislop 0.9.5 → 0.9.6

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
@@ -34,7 +34,7 @@ var __exportAll = (all, no_symbols) => {
34
34
 
35
35
  //#endregion
36
36
  //#region src/version.ts
37
- const APP_VERSION = "0.9.5";
37
+ const APP_VERSION = "0.9.6";
38
38
 
39
39
  //#endregion
40
40
  //#region src/telemetry/env.ts
@@ -2011,11 +2011,18 @@ const DOC_URL_CONTEXT_RE = /\b(?:docs?|documentation|homepage|repository|bugs|li
2011
2011
  const URL_CONFIG_CONTEXT_RE = /\b(?:api|base[_-]?url|baseUrl|endpoint|host|origin|webhook|callback|redirect|server|service|domain|url)\b/i;
2012
2012
  const ENVIRONMENT_HOST_RE = /(?:^|[.-])(?:api|app|admin|auth|staging|stage|prod|dev|sandbox|webhook|internal)(?:[.-]|$)|^(?:localhost|127\.0\.0\.1|0\.0\.0\.0)$/i;
2013
2013
  const ID_CONTEXT_RE = /(?:^|[^A-Za-z0-9])(?:api[_-]?key|client[_-]?id|project[_-]?id|org(?:anization)?[_-]?id|workspace[_-]?id|tenant[_-]?id|price[_-]?id|product[_-]?id|customer[_-]?id|subscription[_-]?id|account[_-]?id|app[_-]?id|key|token|secret)(?:$|[^A-Za-z0-9])/i;
2014
+ const MIGRATION_PATH_RE$1 = /(?:^|[\\/])(?:migrations?|db[\\/]migrate)[\\/]/i;
2014
2015
  const PLACEHOLDER_HOSTS = new Set([
2015
2016
  "example.com",
2016
2017
  "example.org",
2017
2018
  "example.net"
2018
2019
  ]);
2020
+ const LOOPBACK_HOSTS = new Set([
2021
+ "localhost",
2022
+ "127.0.0.1",
2023
+ "0.0.0.0",
2024
+ "::1"
2025
+ ]);
2019
2026
  const PLACEHOLDER_ID_RE = /^(?:changeme|replace[_-]?me|your[_-]|example|placeholder|todo)/i;
2020
2027
  const HARDCODED_URL_FINDING = {
2021
2028
  rule: "ai-slop/hardcoded-url",
@@ -2059,14 +2066,17 @@ const shouldFlagUrlLiteral = (line, urlText) => {
2059
2066
  const host = safeUrlHost(urlText);
2060
2067
  if (!host) return false;
2061
2068
  if (PLACEHOLDER_HOSTS.has(host)) return false;
2069
+ if (LOOPBACK_HOSTS.has(host)) return false;
2062
2070
  if (DOC_URL_CONTEXT_RE.test(line) && !ENVIRONMENT_HOST_RE.test(host)) return false;
2063
2071
  return URL_CONFIG_CONTEXT_RE.test(line) || ENVIRONMENT_HOST_RE.test(host);
2064
2072
  };
2073
+ const ENV_VAR_NAME_RE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
2065
2074
  const hasUsefulIdShape = (value) => {
2066
2075
  if (PLACEHOLDER_ID_RE.test(value)) return false;
2076
+ if (ENV_VAR_NAME_RE.test(value)) return false;
2067
2077
  if (/^https?:\/\//i.test(value)) return false;
2068
2078
  if (/^[A-Za-z]+$/.test(value)) return false;
2069
- return /[0-9_-]/.test(value);
2079
+ return /[0-9]/.test(value);
2070
2080
  };
2071
2081
  const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
2072
2082
  const diagnostics = [];
@@ -2093,6 +2103,7 @@ const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
2093
2103
  const scanFileForConfigLiterals = (content, relativePath, ext) => {
2094
2104
  if (!SOURCE_EXTENSIONS.has(ext)) return [];
2095
2105
  if (isNonProductionPath(relativePath)) return [];
2106
+ if (MIGRATION_PATH_RE$1.test(relativePath)) return [];
2096
2107
  return content.split("\n").flatMap((line, index) => scanLineForConfigLiterals(line, relativePath, ext, index + 1));
2097
2108
  };
2098
2109
  const detectHardcodedConfigLiterals = async (context) => {
@@ -2411,6 +2422,7 @@ const PYTHON_IMPORT_TO_PIP = {
2411
2422
  pptx: ["python-pptx"],
2412
2423
  git: ["gitpython"],
2413
2424
  socks: ["pysocks"],
2425
+ psycopg2: ["psycopg2-binary", "psycopg2"],
2414
2426
  redis: ["redis"],
2415
2427
  cairo: ["pycairo"],
2416
2428
  serial: ["pyserial"],
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as getEngineLabel, t as ENGINE_INFO } from "./engine-info-DCvIfZ0f.js";
2
2
  import { n as runSubprocess, t as isToolInstalled } from "./subprocess-CQUJDGgn.js";
3
- import { t as APP_VERSION } from "./version-ls3wZmOU.js";
3
+ import { t as APP_VERSION } from "./version-CPpO6jbj.js";
4
4
  import { r as runGenericLinter, t as fixRubyLint } from "./generic-D_T4cUaC.js";
5
5
  import { n as runExpoDoctor } from "./expo-doctor-BcIkOte5.js";
6
6
  import { createRequire, isBuiltin } from "node:module";
@@ -2180,11 +2180,18 @@ const DOC_URL_CONTEXT_RE = /\b(?:docs?|documentation|homepage|repository|bugs|li
2180
2180
  const URL_CONFIG_CONTEXT_RE = /\b(?:api|base[_-]?url|baseUrl|endpoint|host|origin|webhook|callback|redirect|server|service|domain|url)\b/i;
2181
2181
  const ENVIRONMENT_HOST_RE = /(?:^|[.-])(?:api|app|admin|auth|staging|stage|prod|dev|sandbox|webhook|internal)(?:[.-]|$)|^(?:localhost|127\.0\.0\.1|0\.0\.0\.0)$/i;
2182
2182
  const ID_CONTEXT_RE = /(?:^|[^A-Za-z0-9])(?:api[_-]?key|client[_-]?id|project[_-]?id|org(?:anization)?[_-]?id|workspace[_-]?id|tenant[_-]?id|price[_-]?id|product[_-]?id|customer[_-]?id|subscription[_-]?id|account[_-]?id|app[_-]?id|key|token|secret)(?:$|[^A-Za-z0-9])/i;
2183
+ const MIGRATION_PATH_RE$1 = /(?:^|[\\/])(?:migrations?|db[\\/]migrate)[\\/]/i;
2183
2184
  const PLACEHOLDER_HOSTS = new Set([
2184
2185
  "example.com",
2185
2186
  "example.org",
2186
2187
  "example.net"
2187
2188
  ]);
2189
+ const LOOPBACK_HOSTS = new Set([
2190
+ "localhost",
2191
+ "127.0.0.1",
2192
+ "0.0.0.0",
2193
+ "::1"
2194
+ ]);
2188
2195
  const PLACEHOLDER_ID_RE = /^(?:changeme|replace[_-]?me|your[_-]|example|placeholder|todo)/i;
2189
2196
  const HARDCODED_URL_FINDING = {
2190
2197
  rule: "ai-slop/hardcoded-url",
@@ -2228,14 +2235,17 @@ const shouldFlagUrlLiteral = (line, urlText) => {
2228
2235
  const host = safeUrlHost(urlText);
2229
2236
  if (!host) return false;
2230
2237
  if (PLACEHOLDER_HOSTS.has(host)) return false;
2238
+ if (LOOPBACK_HOSTS.has(host)) return false;
2231
2239
  if (DOC_URL_CONTEXT_RE.test(line) && !ENVIRONMENT_HOST_RE.test(host)) return false;
2232
2240
  return URL_CONFIG_CONTEXT_RE.test(line) || ENVIRONMENT_HOST_RE.test(host);
2233
2241
  };
2242
+ const ENV_VAR_NAME_RE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
2234
2243
  const hasUsefulIdShape = (value) => {
2235
2244
  if (PLACEHOLDER_ID_RE.test(value)) return false;
2245
+ if (ENV_VAR_NAME_RE.test(value)) return false;
2236
2246
  if (/^https?:\/\//i.test(value)) return false;
2237
2247
  if (/^[A-Za-z]+$/.test(value)) return false;
2238
- return /[0-9_-]/.test(value);
2248
+ return /[0-9]/.test(value);
2239
2249
  };
2240
2250
  const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
2241
2251
  const diagnostics = [];
@@ -2262,6 +2272,7 @@ const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
2262
2272
  const scanFileForConfigLiterals = (content, relativePath, ext) => {
2263
2273
  if (!SOURCE_EXTENSIONS.has(ext)) return [];
2264
2274
  if (isNonProductionPath(relativePath)) return [];
2275
+ if (MIGRATION_PATH_RE$1.test(relativePath)) return [];
2265
2276
  return content.split("\n").flatMap((line, index) => scanLineForConfigLiterals(line, relativePath, ext, index + 1));
2266
2277
  };
2267
2278
  const detectHardcodedConfigLiterals = async (context) => {
@@ -2580,6 +2591,7 @@ const PYTHON_IMPORT_TO_PIP = {
2580
2591
  pptx: ["python-pptx"],
2581
2592
  git: ["gitpython"],
2582
2593
  socks: ["pysocks"],
2594
+ psycopg2: ["psycopg2-binary", "psycopg2"],
2583
2595
  redis: ["redis"],
2584
2596
  cairo: ["pycairo"],
2585
2597
  serial: ["pyserial"],
@@ -8301,12 +8313,12 @@ const runScanBody = async (resolvedDir, config, options, projectInfo) => {
8301
8313
  engineTimings
8302
8314
  };
8303
8315
  if (options.sarif) {
8304
- const { buildSarifLog } = await import("./sarif-Cneulb6L.js");
8316
+ const { buildSarifLog } = await import("./sarif-CLVijBAO.js");
8305
8317
  console.log(JSON.stringify(buildSarifLog(results), null, 2));
8306
8318
  return completion;
8307
8319
  }
8308
8320
  if (options.json) {
8309
- const { buildJsonOutput } = await import("./json-CZU3lEfE.js");
8321
+ const { buildJsonOutput } = await import("./json-CxiErSgX.js");
8310
8322
  const jsonOut = buildJsonOutput(results, scoreResult, projectInfo.sourceFileCount, elapsedMs);
8311
8323
  console.log(JSON.stringify(jsonOut, null, 2));
8312
8324
  return completion;
@@ -1,5 +1,5 @@
1
1
  import { t as ENGINE_INFO } from "./engine-info-DCvIfZ0f.js";
2
- import { t as APP_VERSION } from "./version-ls3wZmOU.js";
2
+ import { t as APP_VERSION } from "./version-CPpO6jbj.js";
3
3
 
4
4
  //#region src/output/json.ts
5
5
  const buildJsonOutput = (results, scoreResult, fileCount, elapsedMs) => {
package/dist/mcp.js CHANGED
@@ -1438,11 +1438,18 @@ const DOC_URL_CONTEXT_RE = /\b(?:docs?|documentation|homepage|repository|bugs|li
1438
1438
  const URL_CONFIG_CONTEXT_RE = /\b(?:api|base[_-]?url|baseUrl|endpoint|host|origin|webhook|callback|redirect|server|service|domain|url)\b/i;
1439
1439
  const ENVIRONMENT_HOST_RE = /(?:^|[.-])(?:api|app|admin|auth|staging|stage|prod|dev|sandbox|webhook|internal)(?:[.-]|$)|^(?:localhost|127\.0\.0\.1|0\.0\.0\.0)$/i;
1440
1440
  const ID_CONTEXT_RE = /(?:^|[^A-Za-z0-9])(?:api[_-]?key|client[_-]?id|project[_-]?id|org(?:anization)?[_-]?id|workspace[_-]?id|tenant[_-]?id|price[_-]?id|product[_-]?id|customer[_-]?id|subscription[_-]?id|account[_-]?id|app[_-]?id|key|token|secret)(?:$|[^A-Za-z0-9])/i;
1441
+ const MIGRATION_PATH_RE$1 = /(?:^|[\\/])(?:migrations?|db[\\/]migrate)[\\/]/i;
1441
1442
  const PLACEHOLDER_HOSTS = new Set([
1442
1443
  "example.com",
1443
1444
  "example.org",
1444
1445
  "example.net"
1445
1446
  ]);
1447
+ const LOOPBACK_HOSTS = new Set([
1448
+ "localhost",
1449
+ "127.0.0.1",
1450
+ "0.0.0.0",
1451
+ "::1"
1452
+ ]);
1446
1453
  const PLACEHOLDER_ID_RE = /^(?:changeme|replace[_-]?me|your[_-]|example|placeholder|todo)/i;
1447
1454
  const HARDCODED_URL_FINDING = {
1448
1455
  rule: "ai-slop/hardcoded-url",
@@ -1486,14 +1493,17 @@ const shouldFlagUrlLiteral = (line, urlText) => {
1486
1493
  const host = safeUrlHost(urlText);
1487
1494
  if (!host) return false;
1488
1495
  if (PLACEHOLDER_HOSTS.has(host)) return false;
1496
+ if (LOOPBACK_HOSTS.has(host)) return false;
1489
1497
  if (DOC_URL_CONTEXT_RE.test(line) && !ENVIRONMENT_HOST_RE.test(host)) return false;
1490
1498
  return URL_CONFIG_CONTEXT_RE.test(line) || ENVIRONMENT_HOST_RE.test(host);
1491
1499
  };
1500
+ const ENV_VAR_NAME_RE = /^[A-Z][A-Z0-9]*(?:_[A-Z0-9]+)+$/;
1492
1501
  const hasUsefulIdShape = (value) => {
1493
1502
  if (PLACEHOLDER_ID_RE.test(value)) return false;
1503
+ if (ENV_VAR_NAME_RE.test(value)) return false;
1494
1504
  if (/^https?:\/\//i.test(value)) return false;
1495
1505
  if (/^[A-Za-z]+$/.test(value)) return false;
1496
- return /[0-9_-]/.test(value);
1506
+ return /[0-9]/.test(value);
1497
1507
  };
1498
1508
  const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
1499
1509
  const diagnostics = [];
@@ -1520,6 +1530,7 @@ const scanLineForConfigLiterals = (line, relativePath, ext, lineNumber) => {
1520
1530
  const scanFileForConfigLiterals = (content, relativePath, ext) => {
1521
1531
  if (!SOURCE_EXTENSIONS.has(ext)) return [];
1522
1532
  if (isNonProductionPath(relativePath)) return [];
1533
+ if (MIGRATION_PATH_RE$1.test(relativePath)) return [];
1523
1534
  return content.split("\n").flatMap((line, index) => scanLineForConfigLiterals(line, relativePath, ext, index + 1));
1524
1535
  };
1525
1536
  const detectHardcodedConfigLiterals = async (context) => {
@@ -1838,6 +1849,7 @@ const PYTHON_IMPORT_TO_PIP = {
1838
1849
  pptx: ["python-pptx"],
1839
1850
  git: ["gitpython"],
1840
1851
  socks: ["pysocks"],
1852
+ psycopg2: ["psycopg2-binary", "psycopg2"],
1841
1853
  redis: ["redis"],
1842
1854
  cairo: ["pycairo"],
1843
1855
  serial: ["pyserial"],
@@ -6456,7 +6468,7 @@ const handleAislopBaseline = (input) => {
6456
6468
 
6457
6469
  //#endregion
6458
6470
  //#region src/version.ts
6459
- const APP_VERSION = "0.9.5";
6471
+ const APP_VERSION = "0.9.6";
6460
6472
 
6461
6473
  //#endregion
6462
6474
  //#region src/telemetry/env.ts
@@ -1,4 +1,4 @@
1
- import { t as APP_VERSION } from "./version-ls3wZmOU.js";
1
+ import { t as APP_VERSION } from "./version-CPpO6jbj.js";
2
2
  import path from "node:path";
3
3
 
4
4
  //#region src/output/sarif.ts
@@ -0,0 +1,5 @@
1
+ //#region src/version.ts
2
+ const APP_VERSION = "0.9.6";
3
+
4
+ //#endregion
5
+ export { APP_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aislop",
3
- "version": "0.9.5",
3
+ "version": "0.9.6",
4
4
  "description": "Catch the slop AI coding agents leave in your code: narrative comments, swallowed exceptions, as-any casts, dead code, oversized functions. 40+ rules across 7 languages (TS/JS, Python, Go, Rust, Ruby, PHP, Java). Sub-second, deterministic, no LLM at runtime. MIT-licensed.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +0,0 @@
1
- //#region src/version.ts
2
- const APP_VERSION = "0.9.5";
3
-
4
- //#endregion
5
- export { APP_VERSION as t };