anti-slop-engineering 0.4.0 → 1.0.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.
Files changed (32) hide show
  1. package/.skills.json +1 -1
  2. package/README.md +3 -3
  3. package/SKILL.md +1 -1
  4. package/bin/cli.js +71 -20
  5. package/marketplace.json +1 -1
  6. package/package.json +7 -1
  7. package/references/clean-room-recon.md +7 -7
  8. package/scripts/sre_guard.py +1 -1
  9. package/services/anti-slop-rust/Cargo.lock +757 -0
  10. package/services/anti-slop-rust/Cargo.toml +12 -0
  11. package/services/anti-slop-rust/src/ladder_auditor.rs +112 -0
  12. package/services/anti-slop-rust/src/lib.rs +66 -0
  13. package/services/anti-slop-rust/src/main.rs +197 -0
  14. package/services/anti-slop-rust/src/model.rs +76 -0
  15. package/services/anti-slop-rust/src/path_utils.rs +18 -0
  16. package/services/anti-slop-rust/src/server.rs +100 -0
  17. package/services/anti-slop-rust/src/shit_interceptor.rs +247 -0
  18. package/services/toil-guard-go/cmd/toil-guard/main.go +271 -0
  19. package/services/toil-guard-go/cmd/toil-guard/main_test.go +36 -0
  20. package/services/toil-guard-go/go.mod +3 -0
  21. package/services/toil-guard-go/pkg/model/types.go +61 -0
  22. package/services/toil-guard-go/pkg/server/server.go +142 -0
  23. package/services/toil-guard-go/pkg/server/server_test.go +77 -0
  24. package/services/toil-guard-go/pkg/sre/audit.go +27 -0
  25. package/services/toil-guard-go/pkg/sre/complexity.go +158 -0
  26. package/services/toil-guard-go/pkg/sre/complexity_test.go +81 -0
  27. package/services/toil-guard-go/pkg/sre/dry.go +103 -0
  28. package/services/toil-guard-go/pkg/sre/dry_test.go +84 -0
  29. package/services/toil-guard-go/pkg/sre/sli.go +77 -0
  30. package/services/toil-guard-go/pkg/sre/sli_test.go +55 -0
  31. package/services/toil-guard-go/pkg/sre/toil.go +98 -0
  32. package/services/toil-guard-go/pkg/sre/toil_test.go +53 -0
package/.skills.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://skills.sh/schema.json",
3
3
  "name": "anti-slop-engineering",
4
- "version": "0.4.0",
4
+ "version": "1.0.0",
5
5
  "description": "An Engineering Discipline Playbook & Guard System for AI Coding Agents. Enforces Google SRE, Clean-Room Senior Dev Ladders, and Rust/Go Microservices.",
6
6
  "repository": "https://github.com/imMamdouhaboammar/anti-slop-engineering",
7
7
  "author": "Mamdouh Aboammar",
package/README.md CHANGED
@@ -139,7 +139,7 @@ bunx anti-slop-engineering sre --max-nesting 4 --min-dup-lines 4 --max-function-
139
139
 
140
140
  ### Rust SHIT Interceptor (`services/anti-slop-rust`)
141
141
 
142
- A high-performance Axum HTTP microservice that audits diffs and source for four categories of agent failure — Scope creep (`S`), Hypothetical hardening (`H`), Intent violation (`I`), and Task thrashing (`T`) — plus the Senior Dev Ladder pattern: detecting custom implementations where platform primitives already exist (`crypto.randomUUID()`, `URLSearchParams`, `structuredClone()`).
142
+ A high-performance Axum HTTP microservice that audits diffs and source for Scope creep (`S`), Hypothetical hardening (`H`), and Intent violation (`I`) in diffs, plus regex-based Senior Dev Ladder checks for hand-rolled alternatives to common platform primitives. Task-thrashing detection is not implemented.
143
143
 
144
144
  ```bash
145
145
  # Triage git changes through Rust engine:
@@ -158,9 +158,9 @@ A concurrent Go microservice for high-throughput SRE metric verification. Runs K
158
158
 
159
159
  ```bash
160
160
  # SRE audit across repository:
161
- bunx anti-slop-engineering toil audit
161
+ bunx anti-slop-engineering toil audit .
162
162
 
163
- # Live git telemetry with error budget tracking:
163
+ # Live git diff statistics (not a live error-budget calculation):
164
164
  bunx anti-slop-engineering toil stream
165
165
 
166
166
  # Start Go microservice daemon:
package/SKILL.md CHANGED
@@ -4,7 +4,7 @@ description: Prevent, detect, and repair AI coding slop and dirty engineering in
4
4
  author: Mamdouh Aboammar <mamdouhfces1997@gmail.com>
5
5
  license: MIT
6
6
  metadata:
7
- version: "0.4.0"
7
+ version: "1.0.0"
8
8
  focus: "engineering-discipline"
9
9
  repository: "https://github.com/imMamdouhaboammar/anti-slop-engineering"
10
10
  ---
package/bin/cli.js CHANGED
@@ -3,8 +3,8 @@
3
3
  // Copyright (c) 2026 Mamdouh Aboammar <mamdouhfces1997@gmail.com> and contributors
4
4
 
5
5
  import { spawn } from "node:child_process";
6
- import { existsSync } from "node:fs";
7
- import { dirname, resolve } from "node:path";
6
+ import { existsSync, mkdirSync } from "node:fs";
7
+ import { basename, dirname, resolve } from "node:path";
8
8
  import process from "node:process";
9
9
  import { fileURLToPath } from "node:url";
10
10
 
@@ -13,18 +13,24 @@ const __dirname = dirname(__filename);
13
13
  const rootDir = resolve(__dirname, "..");
14
14
  const diffGuardScript = resolve(rootDir, "scripts", "diff_guard.py");
15
15
  const sreGuardScript = resolve(rootDir, "scripts", "sre_guard.py");
16
- const rustBinPath = existsSync(resolve(rootDir, "dist", "bin", "anti-slop-rust"))
17
- ? resolve(rootDir, "dist", "bin", "anti-slop-rust")
18
- : resolve(rootDir, "services", "anti-slop-rust", "target", "release", "anti-slop-rust");
19
- const goBinPath = existsSync(resolve(rootDir, "dist", "bin", "toil-guard"))
20
- ? resolve(rootDir, "dist", "bin", "toil-guard")
21
- : resolve(rootDir, "services", "toil-guard-go", "bin", "toil-guard");
22
-
16
+ const nativeSuffix = process.platform === "win32" ? ".exe" : "";
17
+ const rustExecutable = "anti-slop-rust" + nativeSuffix;
18
+ const goExecutable = "toil-guard" + nativeSuffix;
19
+ const rustBinPath = existsSync(resolve(rootDir, "dist", "bin", rustExecutable))
20
+ ? resolve(rootDir, "dist", "bin", rustExecutable)
21
+ : resolve(rootDir, "services", "anti-slop-rust", "target", "release", rustExecutable);
22
+ const goBinPath = existsSync(resolve(rootDir, "dist", "bin", goExecutable))
23
+ ? resolve(rootDir, "dist", "bin", goExecutable)
24
+ : resolve(rootDir, "services", "toil-guard-go", "bin", goExecutable);
25
+
26
+ const invokedAs = basename(process.argv[1] ?? "").replace(/\.(?:js|cmd|exe)$/i, "");
27
+ const executableAliases = { "sre-guard": "sre", "rust-guard": "rust", "toil-guard": "toil" };
23
28
  const args = process.argv.slice(2);
29
+ if (executableAliases[invokedAs]) args.unshift(executableAliases[invokedAs]);
24
30
 
25
31
  function printBanner() {
26
32
  console.log(`
27
- 🛡️ Anti-Slop Engineering CLI (v0.4.0)
33
+ 🛡️ Anti-Slop Engineering CLI (v1.0.0)
28
34
  Clean-Room AI Coding Guard & High-Performance Polyglot Architecture
29
35
  Engines: Standard Library Python Guard | Rust Microservice | Go Toil Guard
30
36
  Author: Mamdouh Aboammar <mamdouhfces1997@gmail.com>
@@ -35,7 +41,7 @@ Usage:
35
41
  bunx anti-slop-engineering [command] [options]
36
42
 
37
43
  Commands:
38
- rust, sts Run native Rust Engine (Scope Creep, Hypothetical Hardening, Intent, Task Thrashing, Senior Dev Ladder)
44
+ rust, sts Run native Rust Engine (Scope Creep, Hypothetical Hardening, Intent, Senior Dev Ladder)
39
45
  toil, go-guard Run Go SRE Engine (KISS nesting, DRY token window, Toil & Error Budget)
40
46
  serve-rust Start background Rust HTTP microservice daemon (default: :9091)
41
47
  serve-go Start background Go HTTP SRE microservice daemon (default: :9092)
@@ -64,7 +70,7 @@ function spawnProcess(execPath, execArgs, label) {
64
70
  process.exit(1);
65
71
  });
66
72
  child.on("close", (code) => {
67
- process.exit(code ?? 0);
73
+ process.exit(code ?? 1); // Signal termination must never be reported as success.
68
74
  });
69
75
  }
70
76
 
@@ -88,6 +94,54 @@ function runPythonScript(scriptPath, scriptArgs, scriptLabel) {
88
94
  spawnProcess("python3", [scriptPath, ...scriptArgs], scriptLabel);
89
95
  }
90
96
 
97
+ function unsupportedFallback(engine, request) {
98
+ console.error(`Error: ${engine} native binary is required for ${request}. Run 'anti-slop-engineering build'.`);
99
+ process.exit(1);
100
+ }
101
+
102
+ function extractCommonFlags(flags, engine, onUnrecognized) {
103
+ const mapped = [];
104
+ for (let i = 0; i < flags.length; i++) {
105
+ const flag = flags[i];
106
+ if (flag === "--base" && flags[i + 1]) {
107
+ mapped.push("--base", flags[++i]);
108
+ } else if (flag === "--format" && flags[i + 1] === "json") {
109
+ mapped.push("--json");
110
+ i++;
111
+ } else if (flag === "--format" && flags[i + 1] === "text") {
112
+ i++;
113
+ } else if (onUnrecognized) {
114
+ onUnrecognized(flag);
115
+ } else {
116
+ unsupportedFallback(engine, `option ${flag}`);
117
+ }
118
+ }
119
+ return mapped;
120
+ }
121
+
122
+ function runRustFallback(request) {
123
+ const [command, ...flags] = request;
124
+ if (command !== "triage") unsupportedFallback("Rust", command);
125
+ const mapped = ["--fail-on-blocker", ...extractCommonFlags(flags, "Rust")];
126
+ runPythonScript(diffGuardScript, mapped, "diff_guard");
127
+ }
128
+
129
+ function runGoFallback(request) {
130
+ const [command, ...flags] = request;
131
+ if (command !== "audit") unsupportedFallback("Go", command);
132
+ const paths = [];
133
+ const mapped = extractCommonFlags(flags, "Go", (flag) => {
134
+ if (flag.startsWith("-")) unsupportedFallback("Go", `audit option ${flag}`);
135
+ else paths.push(flag);
136
+ });
137
+ if (paths.length > 0) {
138
+ if (mapped.includes("--base")) unsupportedFallback("Go", "audit with both --base and paths");
139
+ mapped.push("--files", ...paths);
140
+ } else if (!mapped.includes("--base")) mapped.push("--base", "HEAD");
141
+ mapped.push("--strict");
142
+ runPythonScript(sreGuardScript, mapped, "sre_guard");
143
+ }
144
+
91
145
  function runBuild() {
92
146
  console.log("Compiling Rust microservice...");
93
147
  const cargo = spawn("cargo", ["build", "--release"], {
@@ -102,7 +156,8 @@ function runBuild() {
102
156
  }
103
157
 
104
158
  console.log("Compiling Go microservice...");
105
- const goBuild = spawn("go", ["build", "-o", "bin/toil-guard", "./cmd/toil-guard"], {
159
+ mkdirSync(resolve(rootDir, "services", "toil-guard-go", "bin"), { recursive: true });
160
+ const goBuild = spawn("go", ["build", "-o", "bin/" + goExecutable, "./cmd/toil-guard"], {
106
161
  cwd: resolve(rootDir, "services", "toil-guard-go"),
107
162
  stdio: "inherit",
108
163
  });
@@ -125,15 +180,11 @@ if (cmd === "build") {
125
180
  } else if (cmd === "rust" || cmd === "rust-guard" || cmd === "sts") {
126
181
  const subArgs = args.slice(1);
127
182
  const forwardArgs = subArgs.length > 0 ? subArgs : ["triage"];
128
- runBinary(rustBinPath, forwardArgs, "anti-slop-rust", () => {
129
- runPythonScript(diffGuardScript, ["--base", "HEAD"], "diff_guard");
130
- });
183
+ runBinary(rustBinPath, forwardArgs, "anti-slop-rust", () => runRustFallback(forwardArgs));
131
184
  } else if (cmd === "toil" || cmd === "toil-guard" || cmd === "go-guard") {
132
185
  const subArgs = args.slice(1);
133
186
  const forwardArgs = subArgs.length > 0 ? subArgs : ["audit"];
134
- runBinary(goBinPath, forwardArgs, "toil-guard-go", () => {
135
- runPythonScript(sreGuardScript, ["--base", "HEAD"], "sre_guard");
136
- });
187
+ runBinary(goBinPath, forwardArgs, "toil-guard-go", () => runGoFallback(forwardArgs));
137
188
  } else if (cmd === "serve-rust") {
138
189
  runBinary(rustBinPath, ["serve", ...args.slice(1)], "anti-slop-rust daemon", null);
139
190
  } else if (cmd === "serve-go") {
@@ -164,7 +215,7 @@ Path B: Submit a PR (Problem + Solution Integrated)
164
215
  cwd: rootDir,
165
216
  stdio: "inherit",
166
217
  });
167
- pyTest.on("close", (code) => process.exit(code ?? 0));
218
+ pyTest.on("close", (code) => process.exit(code ?? 1));
168
219
  } else if (cmd === "test-all") {
169
220
  spawnProcess("make", ["test-all"], "test-all");
170
221
  } else if (cmd === "check-all") {
package/marketplace.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-plugin-manifest.json",
3
3
  "name": "anti-slop-engineering",
4
4
  "displayName": "Anti-Slop Engineering",
5
- "version": "0.4.0",
5
+ "version": "1.0.0",
6
6
  "description": "An Engineering Discipline Playbook, Agent Skill & Triage Guard for AI Coding Agents. Enforces behavioral contracts, focused diffs, test integrity, Google SRE principles, and native Rust/Go clean-room microservices.",
7
7
  "author": {
8
8
  "name": "Mamdouh Aboammar",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anti-slop-engineering",
3
- "version": "0.4.0",
3
+ "version": "1.0.0",
4
4
  "description": "An Engineering Discipline Playbook, Agent Skill & Triage Guard for AI Coding Agents",
5
5
  "type": "module",
6
6
  "main": "bin/cli.js",
@@ -22,6 +22,12 @@
22
22
  "files": [
23
23
  "bin",
24
24
  "scripts",
25
+ "services/anti-slop-rust/Cargo.toml",
26
+ "services/anti-slop-rust/Cargo.lock",
27
+ "services/anti-slop-rust/src",
28
+ "services/toil-guard-go/go.mod",
29
+ "services/toil-guard-go/cmd",
30
+ "services/toil-guard-go/pkg",
25
31
  "references",
26
32
  "assets",
27
33
  "SKILL.md",
@@ -59,7 +59,7 @@ No code from any reference repository is copied or decompiled. Only functional m
59
59
  | - Scope Creep Detector | | • Concurrency & Toil Guard |
60
60
  | - Hypothetical Hardening | | • Sliding-Window DRY Scanner |
61
61
  | - Intent Violation Gate | | • SLI/SLO Error Budget Engine|
62
- | - Task Thrashing Watcher | | • Prometheus /metrics Server |
62
+ | - Rule-based diff checks | | • Prometheus /metrics Server |
63
63
  | • Senior Dev Ladder Auditor | | • HTTP REST Service (/v1/..) |
64
64
  | • Axum REST Server (/v1/..) | +------------------------------+
65
65
  +------------------------------+ |
@@ -75,19 +75,19 @@ No code from any reference repository is copied or decompiled. Only functional m
75
75
  ```
76
76
 
77
77
  ### 2.1 Rust Microservice (`services/anti-slop-rust`)
78
- - **Focus:** Ultra-fast AST pattern triage, SHIT boundary violation interception, token waste analysis, and deterministic circuit-breaker protection.
78
+ - **Focus:** Regex-based diff triage for scope, speculative hardening, and read-only intent, plus simple built-in replacement checks.
79
79
  - **Key Modules:**
80
80
  - `src/shit_interceptor.rs`: Scope creep detection, unread checksum/hash generation checks, speculative try-catch error swallowing, and file boundary guards.
81
- - `src/ladder_auditor.rs`: Code reduction ratio auditing, stdlib built-in identification, and 3-point abstraction gate checks.
82
- - `src/server.rs`: Lightweight HTTP microservice (`axum` + `tokio`) exposing `/health`, `/v1/triage`, `/v1/shit-check`, and `/v1/ladder`.
81
+ - `src/ladder_auditor.rs`: Regex-based built-in replacement suggestions and conjunction naming hints.
82
+ - `src/server.rs`: Lightweight HTTP microservice (`axum` + `tokio`) exposing `/health`, `/v1/triage`, `/v1/shit-check`, and `/v1/ladder-audit`.
83
83
  - `src/main.rs`: High-performance CLI interface powered by `clap`.
84
84
 
85
85
  ### 2.2 Go Microservice (`services/toil-guard-go`)
86
86
  - **Focus:** Concurrent repository-wide stream analysis, Google SRE metric verification (KISS, DRY, YAGNI, Scale), automated toil detection, and SLI/SLO budget verification.
87
87
  - **Key Modules:**
88
88
  - `pkg/sre/complexity.go`: Control flow nesting level (<=4) and function length (<=80 lines) verification.
89
- - `pkg/sre/dry_window.go`: Sliding-window token hash scanner across files.
90
- - `pkg/sre/toil.go`: SRE anti-pattern heuristics (unbounded concurrency, blind sleep synchronization, missing exponential backoff + jitter).
89
+ - `pkg/sre/dry.go`: Sliding-window token hash scanner across files.
90
+ - `pkg/sre/toil.go`: SRE anti-pattern heuristics (blind sleep synchronization, fixed retry loops, and silent error swallowing).
91
91
  - `pkg/sre/sli.go`: Error budget calculation and slop index scoring.
92
- - `pkg/server/server.go`: Production Go HTTP microservice with graceful shutdown, `/healthz`, `/metrics`, and `/v1/toil-audit`.
92
+ - `pkg/server/server.go`: Production Go HTTP microservice with graceful shutdown, `/healthz`, `/metrics`, and `/v1/audit`.
93
93
  - `cmd/toil-guard/main.go`: Multi-subcommand CLI runner (`audit`, `stream`, `serve`).
@@ -130,7 +130,7 @@ def normalize_line(line):
130
130
  stripped = line.strip()
131
131
  if not stripped or stripped.startswith(('#', '//', '/*', '*', 'import ', 'from ', 'package ', 'use ')):
132
132
  return ''
133
- if (stripped.startswith('"') and stripped.endswith('"')) or (stripped.startswith("'") and stripped.endswith("'")):
133
+ if re.fullmatch(r'''(?:"[^"]*"|'[^']*'),?''', stripped):
134
134
  return ''
135
135
  if stripped in ('{', '}', '(', ')', '};', '];', ');', 'return', ']', '['):
136
136
  return ''