aislop 0.5.1 → 0.6.0
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/README.md +4 -4
- package/dist/cli.js +1136 -132
- package/dist/index.js +89 -14
- package/dist/{json-D_i2_5_-.js → json-DcE9soYJ.js} +1 -1
- package/dist/{version-CIlgPf8Q.js → version-C2lM_2fE.js} +1 -1
- package/package.json +4 -4
- package/scripts/postinstall-tools.mjs +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ENGINE_INFO, r as getEngineLabel, t as APP_VERSION } from "./version-
|
|
1
|
+
import { n as ENGINE_INFO, r as getEngineLabel, t as APP_VERSION } from "./version-C2lM_2fE.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";
|
|
@@ -1611,7 +1611,49 @@ const MEANINGFUL_JSDOC_TAGS = new Set([
|
|
|
1611
1611
|
"todo",
|
|
1612
1612
|
"link",
|
|
1613
1613
|
"license",
|
|
1614
|
-
"preserve"
|
|
1614
|
+
"preserve",
|
|
1615
|
+
"swagger",
|
|
1616
|
+
"openapi",
|
|
1617
|
+
"route",
|
|
1618
|
+
"group",
|
|
1619
|
+
"summary",
|
|
1620
|
+
"description",
|
|
1621
|
+
"operationid",
|
|
1622
|
+
"response",
|
|
1623
|
+
"responses",
|
|
1624
|
+
"request",
|
|
1625
|
+
"requestbody",
|
|
1626
|
+
"security",
|
|
1627
|
+
"tag",
|
|
1628
|
+
"tags",
|
|
1629
|
+
"path",
|
|
1630
|
+
"body",
|
|
1631
|
+
"query",
|
|
1632
|
+
"queryparam",
|
|
1633
|
+
"header",
|
|
1634
|
+
"headers",
|
|
1635
|
+
"produces",
|
|
1636
|
+
"accept",
|
|
1637
|
+
"middleware",
|
|
1638
|
+
"api",
|
|
1639
|
+
"apiname",
|
|
1640
|
+
"apidefine",
|
|
1641
|
+
"apigroup",
|
|
1642
|
+
"apiparam",
|
|
1643
|
+
"apiquery",
|
|
1644
|
+
"apibody",
|
|
1645
|
+
"apiheader",
|
|
1646
|
+
"apisuccess",
|
|
1647
|
+
"apierror",
|
|
1648
|
+
"apiexample",
|
|
1649
|
+
"apiversion",
|
|
1650
|
+
"apidescription",
|
|
1651
|
+
"apipermission",
|
|
1652
|
+
"apiuse",
|
|
1653
|
+
"apiignore",
|
|
1654
|
+
"apiprivate",
|
|
1655
|
+
"namespace",
|
|
1656
|
+
"category"
|
|
1615
1657
|
]);
|
|
1616
1658
|
const SUPPORTED_EXTS = new Set([
|
|
1617
1659
|
".ts",
|
|
@@ -4951,7 +4993,7 @@ const renderCleanRun = (input, deps = {}) => {
|
|
|
4951
4993
|
//#region src/utils/git.ts
|
|
4952
4994
|
const MAX_BUFFER = 50 * 1024 * 1024;
|
|
4953
4995
|
const getChangedFiles = (cwd, base) => {
|
|
4954
|
-
const
|
|
4996
|
+
const diff = spawnSync("git", [
|
|
4955
4997
|
"diff",
|
|
4956
4998
|
"--name-only",
|
|
4957
4999
|
"--diff-filter=ACMR",
|
|
@@ -4961,8 +5003,22 @@ const getChangedFiles = (cwd, base) => {
|
|
|
4961
5003
|
encoding: "utf-8",
|
|
4962
5004
|
maxBuffer: MAX_BUFFER
|
|
4963
5005
|
});
|
|
4964
|
-
if (
|
|
4965
|
-
|
|
5006
|
+
if (diff.error || diff.status !== 0) return [];
|
|
5007
|
+
const untracked = spawnSync("git", [
|
|
5008
|
+
"ls-files",
|
|
5009
|
+
"--others",
|
|
5010
|
+
"--exclude-standard"
|
|
5011
|
+
], {
|
|
5012
|
+
cwd,
|
|
5013
|
+
encoding: "utf-8",
|
|
5014
|
+
maxBuffer: MAX_BUFFER
|
|
5015
|
+
});
|
|
5016
|
+
const names = /* @__PURE__ */ new Set();
|
|
5017
|
+
for (const line of diff.stdout.split("\n")) if (line.length > 0) names.add(line);
|
|
5018
|
+
if (!untracked.error && untracked.status === 0) {
|
|
5019
|
+
for (const line of untracked.stdout.split("\n")) if (line.length > 0) names.add(line);
|
|
5020
|
+
}
|
|
5021
|
+
return Array.from(names).map((f) => path.resolve(cwd, f));
|
|
4966
5022
|
};
|
|
4967
5023
|
const getStagedFiles = (cwd) => {
|
|
4968
5024
|
const result = spawnSync("git", [
|
|
@@ -5133,7 +5189,7 @@ const scanCommand = async (directory, config, options) => {
|
|
|
5133
5189
|
});
|
|
5134
5190
|
}
|
|
5135
5191
|
if (options.json) {
|
|
5136
|
-
const { buildJsonOutput } = await import("./json-
|
|
5192
|
+
const { buildJsonOutput } = await import("./json-DcE9soYJ.js");
|
|
5137
5193
|
const jsonOut = buildJsonOutput(results, scoreResult, projectInfo.sourceFileCount, elapsedMs);
|
|
5138
5194
|
console.log(JSON.stringify(jsonOut, null, 2));
|
|
5139
5195
|
return { exitCode };
|
|
@@ -5919,7 +5975,13 @@ const fixDependencyAudit = async (context, onProgress) => {
|
|
|
5919
5975
|
await tryNpmOverrides(context.rootDirectory, onProgress);
|
|
5920
5976
|
return;
|
|
5921
5977
|
}
|
|
5922
|
-
await tryPnpmOverrides(context.rootDirectory, onProgress);
|
|
5978
|
+
if (await tryPnpmOverrides(context.rootDirectory, onProgress)) return;
|
|
5979
|
+
if (fs.existsSync(path.join(context.rootDirectory, "package-lock.json"))) {
|
|
5980
|
+
await runNpmAuditFix(context.rootDirectory, onProgress);
|
|
5981
|
+
await tryNpmOverrides(context.rootDirectory, onProgress);
|
|
5982
|
+
return;
|
|
5983
|
+
}
|
|
5984
|
+
onProgress?.("Dependency audit fixes · skipping (pnpm audit unavailable and no package-lock.json for npm fallback)");
|
|
5923
5985
|
};
|
|
5924
5986
|
const runNpmAuditFix = async (rootDir, onProgress) => {
|
|
5925
5987
|
onProgress?.("Dependency audit fixes · running npm audit fix (can take a few minutes)");
|
|
@@ -5951,11 +6013,11 @@ const fetchLatestVersion = async (rootDir, pkgName, pm) => {
|
|
|
5951
6013
|
return null;
|
|
5952
6014
|
}
|
|
5953
6015
|
};
|
|
5954
|
-
const
|
|
6016
|
+
const collectOverrides = async (rootDir, vulnerabilities, pm) => {
|
|
5955
6017
|
const overrides = {};
|
|
5956
6018
|
for (const [pkgName, vuln] of Object.entries(vulnerabilities)) {
|
|
5957
6019
|
if (vuln.fixAvailable !== false || !vuln.range) continue;
|
|
5958
|
-
const latest = await fetchLatestVersion(rootDir, pkgName,
|
|
6020
|
+
const latest = await fetchLatestVersion(rootDir, pkgName, pm);
|
|
5959
6021
|
if (latest) overrides[pkgName] = latest;
|
|
5960
6022
|
}
|
|
5961
6023
|
return overrides;
|
|
@@ -5969,7 +6031,7 @@ const tryNpmOverrides = async (rootDir, onProgress) => {
|
|
|
5969
6031
|
if (!auditResult.stdout) return;
|
|
5970
6032
|
const vulnerabilities = JSON.parse(auditResult.stdout).vulnerabilities;
|
|
5971
6033
|
if (!vulnerabilities) return;
|
|
5972
|
-
const overrides = await
|
|
6034
|
+
const overrides = await collectOverrides(rootDir, vulnerabilities, "npm");
|
|
5973
6035
|
if (Object.keys(overrides).length === 0) return;
|
|
5974
6036
|
const pkgPath = path.join(rootDir, "package.json");
|
|
5975
6037
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
@@ -6005,23 +6067,31 @@ const collectPnpmOverrides = (advisories) => {
|
|
|
6005
6067
|
}
|
|
6006
6068
|
return overrides;
|
|
6007
6069
|
};
|
|
6070
|
+
const isPnpmAuditRetired = (stdout, stderr) => {
|
|
6071
|
+
const haystack = `${stdout}\n${stderr}`.toLowerCase();
|
|
6072
|
+
return haystack.includes("410") || haystack.includes("gone") || haystack.includes("retired") || haystack.includes("endpoint") || haystack.includes("err_pnpm_audit") || haystack.includes("audit endpoint");
|
|
6073
|
+
};
|
|
6008
6074
|
const tryPnpmOverrides = async (rootDir, onProgress) => {
|
|
6009
6075
|
onProgress?.("Dependency audit fixes · running pnpm audit");
|
|
6010
6076
|
const auditResult = await runSubprocess("pnpm", ["audit", "--json"], {
|
|
6011
6077
|
cwd: rootDir,
|
|
6012
6078
|
timeout: AUDIT_TIMEOUT
|
|
6013
6079
|
});
|
|
6014
|
-
if (!auditResult.stdout)
|
|
6080
|
+
if (!auditResult.stdout) {
|
|
6081
|
+
if (isPnpmAuditRetired(auditResult.stdout ?? "", auditResult.stderr ?? "")) return false;
|
|
6082
|
+
return auditResult.exitCode === 0;
|
|
6083
|
+
}
|
|
6015
6084
|
let parsed;
|
|
6016
6085
|
try {
|
|
6017
6086
|
parsed = JSON.parse(auditResult.stdout);
|
|
6018
6087
|
} catch {
|
|
6019
|
-
return;
|
|
6088
|
+
if (auditResult.exitCode !== 0 || isPnpmAuditRetired(auditResult.stdout, auditResult.stderr ?? "")) return false;
|
|
6089
|
+
return true;
|
|
6020
6090
|
}
|
|
6021
6091
|
const advisories = parsed.advisories;
|
|
6022
|
-
if (!advisories || Object.keys(advisories).length === 0) return;
|
|
6092
|
+
if (!advisories || Object.keys(advisories).length === 0) return true;
|
|
6023
6093
|
const overrides = collectPnpmOverrides(advisories);
|
|
6024
|
-
if (Object.keys(overrides).length === 0) return;
|
|
6094
|
+
if (Object.keys(overrides).length === 0) return true;
|
|
6025
6095
|
const pkgPath = path.join(rootDir, "package.json");
|
|
6026
6096
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
6027
6097
|
const pnpmBlock = pkg.pnpm ?? {};
|
|
@@ -6039,6 +6109,7 @@ const tryPnpmOverrides = async (rootDir, onProgress) => {
|
|
|
6039
6109
|
cwd: rootDir,
|
|
6040
6110
|
timeout: INSTALL_TIMEOUT
|
|
6041
6111
|
});
|
|
6112
|
+
return true;
|
|
6042
6113
|
};
|
|
6043
6114
|
const fixExpoDependencies = async (context, onProgress) => {
|
|
6044
6115
|
await removeDisallowedExpoPackages(context.rootDirectory, onProgress);
|
|
@@ -6064,6 +6135,10 @@ const fixExpoDependencies = async (context, onProgress) => {
|
|
|
6064
6135
|
});
|
|
6065
6136
|
if (checkResult.exitCode !== 0) throw new Error(checkResult.stderr || checkResult.stdout || "expo dependency check failed");
|
|
6066
6137
|
};
|
|
6138
|
+
/**
|
|
6139
|
+
* Run expo-doctor to detect packages that should not be installed directly,
|
|
6140
|
+
* then uninstall them. No hardcoded list — expo-doctor is the source of truth.
|
|
6141
|
+
*/
|
|
6067
6142
|
const removeDisallowedExpoPackages = async (rootDir, onProgress) => {
|
|
6068
6143
|
try {
|
|
6069
6144
|
onProgress?.("Expo dependency alignment · running expo-doctor");
|
|
@@ -33,7 +33,7 @@ const getEngineLabel = (engine) => ENGINE_INFO[engine].label;
|
|
|
33
33
|
* Application version — injected at build time by tsdown from package.json.
|
|
34
34
|
* The fallback should always match the "version" field in package.json.
|
|
35
35
|
*/
|
|
36
|
-
const APP_VERSION = "0.
|
|
36
|
+
const APP_VERSION = "0.6.0";
|
|
37
37
|
|
|
38
38
|
//#endregion
|
|
39
39
|
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.
|
|
3
|
+
"version": "0.6.0",
|
|
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": {
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
],
|
|
48
48
|
"author": "heavykenny",
|
|
49
49
|
"license": "MIT",
|
|
50
|
-
"homepage": "https://github.com/
|
|
50
|
+
"homepage": "https://github.com/scanaislop/aislop#readme",
|
|
51
51
|
"repository": {
|
|
52
52
|
"type": "git",
|
|
53
|
-
"url": "git+https://github.com/
|
|
53
|
+
"url": "git+https://github.com/scanaislop/aislop.git"
|
|
54
54
|
},
|
|
55
55
|
"bugs": {
|
|
56
|
-
"url": "https://github.com/
|
|
56
|
+
"url": "https://github.com/scanaislop/aislop/issues"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=20"
|
|
@@ -70,8 +70,8 @@ const TOOL_DEFINITIONS = [
|
|
|
70
70
|
const isWindows = process.platform === "win32";
|
|
71
71
|
const withExecutableExtension = (name) => (isWindows ? `${name}.exe` : name);
|
|
72
72
|
|
|
73
|
-
const info = (message) => console.
|
|
74
|
-
const warn = (message) => console.
|
|
73
|
+
const info = (message) => console.error(`[aislop] ${message}`);
|
|
74
|
+
const warn = (message) => console.error(`[aislop] ${message}`);
|
|
75
75
|
|
|
76
76
|
const downloadFile = async (url, destination) => {
|
|
77
77
|
const response = await fetch(url, {
|