aislop 0.9.3 → 0.9.5

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.
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env node
2
+ import { r as APP_VERSION } from "./cli.js";
3
+ import path from "node:path";
4
+
5
+ //#region src/output/sarif.ts
6
+ const SARIF_VERSION = "2.1.0";
7
+ const SARIF_SCHEMA = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json";
8
+ const levelFromSeverity = (severity) => {
9
+ if (severity === "error") return "error";
10
+ if (severity === "warning") return "warning";
11
+ return "note";
12
+ };
13
+ const oneBased = (value) => value >= 1 ? value : 1;
14
+ const toUri = (filePath) => filePath.split(path.sep).join("/");
15
+ const buildRules = (diagnostics) => {
16
+ const byId = /* @__PURE__ */ new Map();
17
+ for (const d of diagnostics) {
18
+ if (byId.has(d.rule)) continue;
19
+ byId.set(d.rule, {
20
+ id: d.rule,
21
+ name: d.rule,
22
+ shortDescription: { text: d.message },
23
+ help: { text: d.help || d.message }
24
+ });
25
+ }
26
+ return [...byId.values()];
27
+ };
28
+ const buildSarifLog = (results) => {
29
+ const diagnostics = results.flatMap((r) => r.diagnostics);
30
+ const rules = buildRules(diagnostics);
31
+ const ruleIndex = new Map(rules.map((rule, index) => [rule.id, index]));
32
+ const sarifResults = diagnostics.map((d) => ({
33
+ ruleId: d.rule,
34
+ ruleIndex: ruleIndex.get(d.rule) ?? 0,
35
+ level: levelFromSeverity(d.severity),
36
+ message: { text: d.message },
37
+ locations: [{ physicalLocation: {
38
+ artifactLocation: { uri: toUri(d.filePath) },
39
+ region: {
40
+ startLine: oneBased(d.line),
41
+ startColumn: oneBased(d.column)
42
+ }
43
+ } }]
44
+ }));
45
+ return {
46
+ $schema: SARIF_SCHEMA,
47
+ version: SARIF_VERSION,
48
+ runs: [{
49
+ tool: { driver: {
50
+ name: "aislop",
51
+ version: APP_VERSION,
52
+ informationUri: "https://github.com/scanaislop/aislop",
53
+ rules
54
+ } },
55
+ results: sarifResults
56
+ }]
57
+ };
58
+ };
59
+
60
+ //#endregion
61
+ export { buildSarifLog };
@@ -0,0 +1,60 @@
1
+ import { t as APP_VERSION } from "./version-ls3wZmOU.js";
2
+ import path from "node:path";
3
+
4
+ //#region src/output/sarif.ts
5
+ const SARIF_VERSION = "2.1.0";
6
+ const SARIF_SCHEMA = "https://raw.githubusercontent.com/oasis-tcs/sarif-spec/master/Schemata/sarif-schema-2.1.0.json";
7
+ const levelFromSeverity = (severity) => {
8
+ if (severity === "error") return "error";
9
+ if (severity === "warning") return "warning";
10
+ return "note";
11
+ };
12
+ const oneBased = (value) => value >= 1 ? value : 1;
13
+ const toUri = (filePath) => filePath.split(path.sep).join("/");
14
+ const buildRules = (diagnostics) => {
15
+ const byId = /* @__PURE__ */ new Map();
16
+ for (const d of diagnostics) {
17
+ if (byId.has(d.rule)) continue;
18
+ byId.set(d.rule, {
19
+ id: d.rule,
20
+ name: d.rule,
21
+ shortDescription: { text: d.message },
22
+ help: { text: d.help || d.message }
23
+ });
24
+ }
25
+ return [...byId.values()];
26
+ };
27
+ const buildSarifLog = (results) => {
28
+ const diagnostics = results.flatMap((r) => r.diagnostics);
29
+ const rules = buildRules(diagnostics);
30
+ const ruleIndex = new Map(rules.map((rule, index) => [rule.id, index]));
31
+ const sarifResults = diagnostics.map((d) => ({
32
+ ruleId: d.rule,
33
+ ruleIndex: ruleIndex.get(d.rule) ?? 0,
34
+ level: levelFromSeverity(d.severity),
35
+ message: { text: d.message },
36
+ locations: [{ physicalLocation: {
37
+ artifactLocation: { uri: toUri(d.filePath) },
38
+ region: {
39
+ startLine: oneBased(d.line),
40
+ startColumn: oneBased(d.column)
41
+ }
42
+ } }]
43
+ }));
44
+ return {
45
+ $schema: SARIF_SCHEMA,
46
+ version: SARIF_VERSION,
47
+ runs: [{
48
+ tool: { driver: {
49
+ name: "aislop",
50
+ version: APP_VERSION,
51
+ informationUri: "https://github.com/scanaislop/aislop",
52
+ rules
53
+ } },
54
+ results: sarifResults
55
+ }]
56
+ };
57
+ };
58
+
59
+ //#endregion
60
+ export { buildSarifLog };
@@ -0,0 +1,5 @@
1
+ //#region src/version.ts
2
+ const APP_VERSION = "0.9.5";
3
+
4
+ //#endregion
5
+ export { APP_VERSION as t };
package/package.json CHANGED
@@ -1,93 +1,95 @@
1
1
  {
2
- "name": "aislop",
3
- "version": "0.9.3",
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
- "type": "module",
6
- "bin": {
7
- "aislop": "./dist/cli.js",
8
- "aislop-mcp": "./dist/mcp.js"
9
- },
10
- "files": [
11
- "dist",
12
- "scripts"
13
- ],
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.ts",
17
- "default": "./dist/index.js"
18
- }
19
- },
20
- "scripts": {
21
- "dev": "tsdown --watch",
22
- "build": "rm -rf dist && NODE_ENV=production tsdown",
23
- "postinstall": "node scripts/postinstall-tools.mjs",
24
- "typecheck": "tsc --noEmit",
25
- "test": "pnpm build && vitest run",
26
- "scan": "pnpm build && node dist/cli.js scan .",
27
- "scan:exclude": "pnpm build && node dist/cli.js scan . --exclude .idea --exclude .gitnore --exclude node_modules",
28
- "scan:include": "pnpm build && node dist/cli.js scan . --include src --include tests",
29
- "scan:json": "pnpm build && node dist/cli.js scan . --json",
30
- "quality": "pnpm typecheck && pnpm test && node dist/cli.js scan . --json"
31
- },
32
- "keywords": [
33
- "aislop",
34
- "ai-slop",
35
- "code-quality",
36
- "linter",
37
- "formatter",
38
- "cli",
39
- "ai",
40
- "copilot",
41
- "code-review",
42
- "static-analysis",
43
- "typescript",
44
- "javascript",
45
- "python",
46
- "go",
47
- "rust",
48
- "ruby",
49
- "php"
50
- ],
51
- "author": "heavykenny",
52
- "license": "MIT",
53
- "homepage": "https://github.com/scanaislop/aislop#readme",
54
- "repository": {
55
- "type": "git",
56
- "url": "git+https://github.com/scanaislop/aislop.git"
57
- },
58
- "bugs": {
59
- "url": "https://github.com/scanaislop/aislop/issues"
60
- },
61
- "engines": {
62
- "node": ">=20"
63
- },
64
- "packageManager": "pnpm@10.28.0",
65
- "dependencies": {
66
- "@biomejs/biome": "^2.4.5",
67
- "@clack/prompts": "^1.2.0",
68
- "@modelcontextprotocol/sdk": "^1.29.0",
69
- "adm-zip": "^0.5.16",
70
- "commander": "^14.0.3",
71
- "expo-doctor": "^1.18.10",
72
- "knip": "^5.85.0",
73
- "micromatch": "^4.0.8",
74
- "oxlint": "^1.51.0",
75
- "picocolors": "^1.1.1",
76
- "tar": "^7.5.11",
77
- "typescript": "^5.9.3",
78
- "wcwidth": "^1.0.1",
79
- "yaml": "^2.8.2",
80
- "zod": "^4.3.6"
81
- },
82
- "devDependencies": {
83
- "@types/micromatch": "^4.0.10",
84
- "@types/node": "^25.6.0",
85
- "tsdown": "^0.20.3",
86
- "vitest": "^4.0.18"
87
- },
88
- "pnpm": {
89
- "overrides": {
90
- "postcss@<8.5.10": "^8.5.10"
91
- }
92
- }
2
+ "name": "aislop",
3
+ "version": "0.9.5",
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
+ "type": "module",
6
+ "bin": {
7
+ "aislop": "./dist/cli.js",
8
+ "aislop-mcp": "./dist/mcp.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "scripts"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "default": "./dist/index.js"
18
+ }
19
+ },
20
+ "scripts": {
21
+ "dev": "tsdown --watch",
22
+ "build": "rm -rf dist && NODE_ENV=production tsdown",
23
+ "postinstall": "node scripts/postinstall-tools.mjs",
24
+ "typecheck": "tsc --noEmit",
25
+ "gen:schema": "node --experimental-strip-types scripts/gen-config-schema.mjs",
26
+ "test": "pnpm build && vitest run",
27
+ "scan": "pnpm build && node dist/cli.js scan .",
28
+ "scan:exclude": "pnpm build && node dist/cli.js scan . --exclude .idea --exclude .gitnore --exclude node_modules",
29
+ "scan:include": "pnpm build && node dist/cli.js scan . --include src --include tests",
30
+ "scan:json": "pnpm build && node dist/cli.js scan . --json",
31
+ "quality": "pnpm typecheck && pnpm test && node dist/cli.js scan . --json"
32
+ },
33
+ "keywords": [
34
+ "aislop",
35
+ "ai-slop",
36
+ "code-quality",
37
+ "linter",
38
+ "formatter",
39
+ "cli",
40
+ "ai",
41
+ "copilot",
42
+ "code-review",
43
+ "static-analysis",
44
+ "typescript",
45
+ "javascript",
46
+ "python",
47
+ "go",
48
+ "rust",
49
+ "ruby",
50
+ "php"
51
+ ],
52
+ "author": "heavykenny",
53
+ "license": "MIT",
54
+ "homepage": "https://github.com/scanaislop/aislop#readme",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "git+https://github.com/scanaislop/aislop.git"
58
+ },
59
+ "bugs": {
60
+ "url": "https://github.com/scanaislop/aislop/issues"
61
+ },
62
+ "engines": {
63
+ "node": ">=20"
64
+ },
65
+ "packageManager": "pnpm@10.28.0",
66
+ "dependencies": {
67
+ "@biomejs/biome": "^2.4.5",
68
+ "@clack/prompts": "^1.2.0",
69
+ "@modelcontextprotocol/sdk": "^1.29.0",
70
+ "adm-zip": "^0.5.16",
71
+ "commander": "^14.0.3",
72
+ "expo-doctor": "^1.18.10",
73
+ "knip": "^5.85.0",
74
+ "micromatch": "^4.0.8",
75
+ "oxlint": "^1.51.0",
76
+ "picocolors": "^1.1.1",
77
+ "tar": "^7.5.11",
78
+ "typescript": "^5.9.3",
79
+ "wcwidth": "^1.0.1",
80
+ "yaml": "^2.8.2",
81
+ "zod": "^4.3.6"
82
+ },
83
+ "devDependencies": {
84
+ "@types/micromatch": "^4.0.10",
85
+ "@types/node": "^25.6.0",
86
+ "tsdown": "^0.20.3",
87
+ "vitest": "^4.0.18"
88
+ },
89
+ "pnpm": {
90
+ "overrides": {
91
+ "postcss@<8.5.10": "^8.5.10",
92
+ "qs@>=6.11.1 <=6.15.1": "^6.15.2"
93
+ }
94
+ }
93
95
  }
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import { writeFileSync } from "node:fs";
3
+ import { dirname, resolve } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { z } from "zod/v4";
6
+ import { AislopConfigSchema } from "../src/config/schema.ts";
7
+
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+ const outPath = resolve(here, "..", "schema", "aislop.config.schema.json");
10
+
11
+ // Strip `required`/`additionalProperties:false` so partial user configs (every
12
+ // key has a default) validate, and allow the loader-handled `extends` key.
13
+ const relax = (node) => {
14
+ if (!node || typeof node !== "object") return;
15
+ if (Array.isArray(node)) {
16
+ for (const item of node) relax(item);
17
+ return;
18
+ }
19
+ delete node.required;
20
+ if (node.additionalProperties === false) delete node.additionalProperties;
21
+ for (const value of Object.values(node)) relax(value);
22
+ };
23
+
24
+ const jsonSchema = z.toJSONSchema(AislopConfigSchema, { target: "draft-2020-12" });
25
+ relax(jsonSchema);
26
+ jsonSchema.$id = "https://scanaislop.com/schema/aislop.config.schema.json";
27
+ jsonSchema.title = "aislop configuration (.aislop/config.yml)";
28
+ jsonSchema.description = "Configuration schema for the aislop code-quality CLI.";
29
+ jsonSchema.properties.extends = {
30
+ type: "string",
31
+ description: "Path to a parent .aislop config to extend.",
32
+ };
33
+
34
+ writeFileSync(outPath, `${JSON.stringify(jsonSchema, null, "\t")}\n`);
35
+ process.stdout.write(`Wrote ${outPath}\n`);