aislop 0.8.2 → 0.8.3

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
@@ -1452,6 +1452,27 @@ const collectJsDeps = (rootDir, jsDeps) => {
1452
1452
  collectNestedManifests(rootDir, jsDeps);
1453
1453
  return true;
1454
1454
  };
1455
+ const TS_CONFIG_FILES = ["tsconfig.json", "jsconfig.json"];
1456
+ const buildAliasMatcher = (key) => {
1457
+ const starIdx = key.indexOf("*");
1458
+ if (starIdx === -1) return (spec) => spec === key;
1459
+ const before = key.slice(0, starIdx);
1460
+ const after = key.slice(starIdx + 1);
1461
+ return (spec) => spec.length >= before.length + after.length && spec.startsWith(before) && spec.endsWith(after);
1462
+ };
1463
+ const collectAliasMatchersFromConfig = (configPath, matchers) => {
1464
+ const opts = readJson(configPath)?.compilerOptions;
1465
+ if (!opts || typeof opts !== "object") return;
1466
+ const paths = opts.paths;
1467
+ if (!paths || typeof paths !== "object") return;
1468
+ for (const key of Object.keys(paths)) matchers.push(buildAliasMatcher(key));
1469
+ };
1470
+ const collectTsPathAliases = (rootDir) => {
1471
+ const matchers = [];
1472
+ const dirs = [rootDir, ...expandWorkspaceDirs(rootDir, readWorkspaceGlobs(rootDir, readJson(path.join(rootDir, "package.json"))))];
1473
+ for (const dir of dirs) for (const fname of TS_CONFIG_FILES) collectAliasMatchersFromConfig(path.join(dir, fname), matchers);
1474
+ return matchers;
1475
+ };
1455
1476
  const addPyDep = (pyDeps, name) => {
1456
1477
  const normalized = name.toLowerCase().replace(/_/g, "-");
1457
1478
  pyDeps.add(normalized);
@@ -1609,10 +1630,11 @@ const extractPyImports = (content) => {
1609
1630
  }
1610
1631
  return results;
1611
1632
  };
1612
- const checkJsImport = (spec, manifest) => {
1633
+ const checkJsImport = (spec, manifest, tsAliasMatchers) => {
1613
1634
  if (isJsRelativeOrAbsolute(spec)) return null;
1614
1635
  if (isJsBuiltin(spec)) return null;
1615
1636
  if (isJsVirtualModule(spec)) return null;
1637
+ if (tsAliasMatchers.some((m) => m(spec))) return null;
1616
1638
  const pkg = packageNameFromImport(spec);
1617
1639
  if (manifest.jsDeps.has(pkg)) return null;
1618
1640
  if (pkg.startsWith("@types/")) {
@@ -1633,6 +1655,7 @@ const checkPyImport = (spec, manifest) => {
1633
1655
  const detectHallucinatedImports = async (context) => {
1634
1656
  const manifest = loadManifest(context.rootDirectory);
1635
1657
  if (!manifest.hasJsManifest && !manifest.hasPyManifest) return [];
1658
+ const tsAliasMatchers = manifest.hasJsManifest ? collectTsPathAliases(context.rootDirectory) : [];
1636
1659
  const diagnostics = [];
1637
1660
  const files = getSourceFiles(context);
1638
1661
  for (const filePath of files) {
@@ -1652,7 +1675,7 @@ const detectHallucinatedImports = async (context) => {
1652
1675
  const relPath = path.relative(context.rootDirectory, filePath);
1653
1676
  const imports = isJs ? extractJsImports(content) : extractPyImports(content);
1654
1677
  for (const { spec, line } of imports) {
1655
- const hallucinated = isJs ? checkJsImport(spec, manifest) : checkPyImport(spec, manifest);
1678
+ const hallucinated = isJs ? checkJsImport(spec, manifest, tsAliasMatchers) : checkPyImport(spec, manifest);
1656
1679
  if (!hallucinated) continue;
1657
1680
  const manifestLabel = isJs ? "package.json" : "requirements.txt / pyproject.toml / Pipfile";
1658
1681
  diagnostics.push({
@@ -7571,7 +7594,7 @@ const renderCleanRun = (input, deps = {}) => {
7571
7594
 
7572
7595
  //#endregion
7573
7596
  //#region src/version.ts
7574
- const APP_VERSION = "0.8.2";
7597
+ const APP_VERSION = "0.8.3";
7575
7598
 
7576
7599
  //#endregion
7577
7600
  //#region src/utils/telemetry.ts
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as ENGINE_INFO, r as getEngineLabel, t as APP_VERSION } from "./version-G3ekYjY1.js";
1
+ import { n as ENGINE_INFO, r as getEngineLabel, t as APP_VERSION } from "./version-BynHxO1X.js";
2
2
  import { n as runSubprocess, t as isToolInstalled } from "./subprocess-CQUJDGgn.js";
3
3
  import { r as runGenericLinter, t as fixRubyLint } from "./generic-BrcWMW7E.js";
4
4
  import { n as runExpoDoctor } from "./expo-doctor-Bz0LZhQ6.js";
@@ -1994,6 +1994,27 @@ const collectJsDeps = (rootDir, jsDeps) => {
1994
1994
  collectNestedManifests(rootDir, jsDeps);
1995
1995
  return true;
1996
1996
  };
1997
+ const TS_CONFIG_FILES = ["tsconfig.json", "jsconfig.json"];
1998
+ const buildAliasMatcher = (key) => {
1999
+ const starIdx = key.indexOf("*");
2000
+ if (starIdx === -1) return (spec) => spec === key;
2001
+ const before = key.slice(0, starIdx);
2002
+ const after = key.slice(starIdx + 1);
2003
+ return (spec) => spec.length >= before.length + after.length && spec.startsWith(before) && spec.endsWith(after);
2004
+ };
2005
+ const collectAliasMatchersFromConfig = (configPath, matchers) => {
2006
+ const opts = readJson(configPath)?.compilerOptions;
2007
+ if (!opts || typeof opts !== "object") return;
2008
+ const paths = opts.paths;
2009
+ if (!paths || typeof paths !== "object") return;
2010
+ for (const key of Object.keys(paths)) matchers.push(buildAliasMatcher(key));
2011
+ };
2012
+ const collectTsPathAliases = (rootDir) => {
2013
+ const matchers = [];
2014
+ const dirs = [rootDir, ...expandWorkspaceDirs(rootDir, readWorkspaceGlobs(rootDir, readJson(path.join(rootDir, "package.json"))))];
2015
+ for (const dir of dirs) for (const fname of TS_CONFIG_FILES) collectAliasMatchersFromConfig(path.join(dir, fname), matchers);
2016
+ return matchers;
2017
+ };
1997
2018
  const addPyDep = (pyDeps, name) => {
1998
2019
  const normalized = name.toLowerCase().replace(/_/g, "-");
1999
2020
  pyDeps.add(normalized);
@@ -2151,10 +2172,11 @@ const extractPyImports = (content) => {
2151
2172
  }
2152
2173
  return results;
2153
2174
  };
2154
- const checkJsImport = (spec, manifest) => {
2175
+ const checkJsImport = (spec, manifest, tsAliasMatchers) => {
2155
2176
  if (isJsRelativeOrAbsolute(spec)) return null;
2156
2177
  if (isJsBuiltin(spec)) return null;
2157
2178
  if (isJsVirtualModule(spec)) return null;
2179
+ if (tsAliasMatchers.some((m) => m(spec))) return null;
2158
2180
  const pkg = packageNameFromImport(spec);
2159
2181
  if (manifest.jsDeps.has(pkg)) return null;
2160
2182
  if (pkg.startsWith("@types/")) {
@@ -2175,6 +2197,7 @@ const checkPyImport = (spec, manifest) => {
2175
2197
  const detectHallucinatedImports = async (context) => {
2176
2198
  const manifest = loadManifest(context.rootDirectory);
2177
2199
  if (!manifest.hasJsManifest && !manifest.hasPyManifest) return [];
2200
+ const tsAliasMatchers = manifest.hasJsManifest ? collectTsPathAliases(context.rootDirectory) : [];
2178
2201
  const diagnostics = [];
2179
2202
  const files = getSourceFiles(context);
2180
2203
  for (const filePath of files) {
@@ -2194,7 +2217,7 @@ const detectHallucinatedImports = async (context) => {
2194
2217
  const relPath = path.relative(context.rootDirectory, filePath);
2195
2218
  const imports = isJs ? extractJsImports(content) : extractPyImports(content);
2196
2219
  for (const { spec, line } of imports) {
2197
- const hallucinated = isJs ? checkJsImport(spec, manifest) : checkPyImport(spec, manifest);
2220
+ const hallucinated = isJs ? checkJsImport(spec, manifest, tsAliasMatchers) : checkPyImport(spec, manifest);
2198
2221
  if (!hallucinated) continue;
2199
2222
  const manifestLabel = isJs ? "package.json" : "requirements.txt / pyproject.toml / Pipfile";
2200
2223
  diagnostics.push({
@@ -6376,7 +6399,7 @@ const scanCommand = async (directory, config, options) => {
6376
6399
  });
6377
6400
  }
6378
6401
  if (options.json) {
6379
- const { buildJsonOutput } = await import("./json-DxLkV8n2.js");
6402
+ const { buildJsonOutput } = await import("./json-D8h2EZW6.js");
6380
6403
  const jsonOut = buildJsonOutput(results, scoreResult, projectInfo.sourceFileCount, elapsedMs);
6381
6404
  console.log(JSON.stringify(jsonOut, null, 2));
6382
6405
  return { exitCode };
@@ -1,4 +1,4 @@
1
- import { n as ENGINE_INFO, t as APP_VERSION } from "./version-G3ekYjY1.js";
1
+ import { n as ENGINE_INFO, t as APP_VERSION } from "./version-BynHxO1X.js";
2
2
 
3
3
  //#region src/output/json.ts
4
4
  const buildJsonOutput = (results, scoreResult, fileCount, elapsedMs) => {
package/dist/mcp.js CHANGED
@@ -1253,6 +1253,27 @@ const collectJsDeps = (rootDir, jsDeps) => {
1253
1253
  collectNestedManifests(rootDir, jsDeps);
1254
1254
  return true;
1255
1255
  };
1256
+ const TS_CONFIG_FILES = ["tsconfig.json", "jsconfig.json"];
1257
+ const buildAliasMatcher = (key) => {
1258
+ const starIdx = key.indexOf("*");
1259
+ if (starIdx === -1) return (spec) => spec === key;
1260
+ const before = key.slice(0, starIdx);
1261
+ const after = key.slice(starIdx + 1);
1262
+ return (spec) => spec.length >= before.length + after.length && spec.startsWith(before) && spec.endsWith(after);
1263
+ };
1264
+ const collectAliasMatchersFromConfig = (configPath, matchers) => {
1265
+ const opts = readJson(configPath)?.compilerOptions;
1266
+ if (!opts || typeof opts !== "object") return;
1267
+ const paths = opts.paths;
1268
+ if (!paths || typeof paths !== "object") return;
1269
+ for (const key of Object.keys(paths)) matchers.push(buildAliasMatcher(key));
1270
+ };
1271
+ const collectTsPathAliases = (rootDir) => {
1272
+ const matchers = [];
1273
+ const dirs = [rootDir, ...expandWorkspaceDirs(rootDir, readWorkspaceGlobs(rootDir, readJson(path.join(rootDir, "package.json"))))];
1274
+ for (const dir of dirs) for (const fname of TS_CONFIG_FILES) collectAliasMatchersFromConfig(path.join(dir, fname), matchers);
1275
+ return matchers;
1276
+ };
1256
1277
  const addPyDep = (pyDeps, name) => {
1257
1278
  const normalized = name.toLowerCase().replace(/_/g, "-");
1258
1279
  pyDeps.add(normalized);
@@ -1410,10 +1431,11 @@ const extractPyImports = (content) => {
1410
1431
  }
1411
1432
  return results;
1412
1433
  };
1413
- const checkJsImport = (spec, manifest) => {
1434
+ const checkJsImport = (spec, manifest, tsAliasMatchers) => {
1414
1435
  if (isJsRelativeOrAbsolute(spec)) return null;
1415
1436
  if (isJsBuiltin(spec)) return null;
1416
1437
  if (isJsVirtualModule(spec)) return null;
1438
+ if (tsAliasMatchers.some((m) => m(spec))) return null;
1417
1439
  const pkg = packageNameFromImport(spec);
1418
1440
  if (manifest.jsDeps.has(pkg)) return null;
1419
1441
  if (pkg.startsWith("@types/")) {
@@ -1434,6 +1456,7 @@ const checkPyImport = (spec, manifest) => {
1434
1456
  const detectHallucinatedImports = async (context) => {
1435
1457
  const manifest = loadManifest(context.rootDirectory);
1436
1458
  if (!manifest.hasJsManifest && !manifest.hasPyManifest) return [];
1459
+ const tsAliasMatchers = manifest.hasJsManifest ? collectTsPathAliases(context.rootDirectory) : [];
1437
1460
  const diagnostics = [];
1438
1461
  const files = getSourceFiles(context);
1439
1462
  for (const filePath of files) {
@@ -1453,7 +1476,7 @@ const detectHallucinatedImports = async (context) => {
1453
1476
  const relPath = path.relative(context.rootDirectory, filePath);
1454
1477
  const imports = isJs ? extractJsImports(content) : extractPyImports(content);
1455
1478
  for (const { spec, line } of imports) {
1456
- const hallucinated = isJs ? checkJsImport(spec, manifest) : checkPyImport(spec, manifest);
1479
+ const hallucinated = isJs ? checkJsImport(spec, manifest, tsAliasMatchers) : checkPyImport(spec, manifest);
1457
1480
  if (!hallucinated) continue;
1458
1481
  const manifestLabel = isJs ? "package.json" : "requirements.txt / pyproject.toml / Pipfile";
1459
1482
  diagnostics.push({
@@ -5071,7 +5094,7 @@ const handleAislopBaseline = (input) => {
5071
5094
 
5072
5095
  //#endregion
5073
5096
  //#region src/version.ts
5074
- const APP_VERSION = "0.8.2";
5097
+ const APP_VERSION = "0.8.3";
5075
5098
 
5076
5099
  //#endregion
5077
5100
  //#region src/mcp.ts
@@ -29,7 +29,7 @@ const getEngineLabel = (engine) => ENGINE_INFO[engine].label;
29
29
 
30
30
  //#endregion
31
31
  //#region src/version.ts
32
- const APP_VERSION = "0.8.2";
32
+ const APP_VERSION = "0.8.3";
33
33
 
34
34
  //#endregion
35
35
  export { ENGINE_INFO as n, getEngineLabel as r, APP_VERSION as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aislop",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "The engineering standards layer and quality gate for AI-written code. Define your standard once. Every agent — Claude Code, Cursor, Codex — is held to it automatically, on every edit and every PR. Catches the slop they leave behind, enforces the rules your team sets. 8+ languages. Deterministic.",
5
5
  "type": "module",
6
6
  "bin": {