ai-code-quality-auditor 0.1.0__tar.gz

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 (62) hide show
  1. ai_code_quality_auditor-0.1.0/LICENSE +21 -0
  2. ai_code_quality_auditor-0.1.0/PKG-INFO +148 -0
  3. ai_code_quality_auditor-0.1.0/README.md +71 -0
  4. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/PKG-INFO +148 -0
  5. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/SOURCES.txt +60 -0
  6. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/dependency_links.txt +1 -0
  7. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/entry_points.txt +2 -0
  8. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/requires.txt +35 -0
  9. ai_code_quality_auditor-0.1.0/ai_code_quality_auditor.egg-info/top_level.txt +1 -0
  10. ai_code_quality_auditor-0.1.0/auditor/__init__.py +0 -0
  11. ai_code_quality_auditor-0.1.0/auditor/adapters/__init__.py +0 -0
  12. ai_code_quality_auditor-0.1.0/auditor/adapters/antigravity_adapter.py +139 -0
  13. ai_code_quality_auditor-0.1.0/auditor/adapters/base_adapter.py +14 -0
  14. ai_code_quality_auditor-0.1.0/auditor/adapters/claude_code_adapter.py +151 -0
  15. ai_code_quality_auditor-0.1.0/auditor/adapters/cursor_agent_adapter.py +124 -0
  16. ai_code_quality_auditor-0.1.0/auditor/adapters/human_control_adapter.py +101 -0
  17. ai_code_quality_auditor-0.1.0/auditor/adapters/human_control_recorder.py +97 -0
  18. ai_code_quality_auditor-0.1.0/auditor/adapters/replit_agent_adapter.py +140 -0
  19. ai_code_quality_auditor-0.1.0/auditor/analyzers/__init__.py +0 -0
  20. ai_code_quality_auditor-0.1.0/auditor/analyzers/complexity_analyzer.py +34 -0
  21. ai_code_quality_auditor-0.1.0/auditor/analyzers/duplication_analyzer.py +55 -0
  22. ai_code_quality_auditor-0.1.0/auditor/analyzers/hallucination_analyzer.py +23 -0
  23. ai_code_quality_auditor-0.1.0/auditor/analyzers/keystroke_analyzer.py +12 -0
  24. ai_code_quality_auditor-0.1.0/auditor/analyzers/manifest_deriver.py +62 -0
  25. ai_code_quality_auditor-0.1.0/auditor/analyzers/security_analyzer.py +63 -0
  26. ai_code_quality_auditor-0.1.0/auditor/core/__init__.py +0 -0
  27. ai_code_quality_auditor-0.1.0/auditor/core/cli.py +52 -0
  28. ai_code_quality_auditor-0.1.0/auditor/core/config.py +21 -0
  29. ai_code_quality_auditor-0.1.0/auditor/core/experiment.py +149 -0
  30. ai_code_quality_auditor-0.1.0/auditor/core/logger.py +13 -0
  31. ai_code_quality_auditor-0.1.0/auditor/core/runner.py +52 -0
  32. ai_code_quality_auditor-0.1.0/auditor/dashboard/__init__.py +0 -0
  33. ai_code_quality_auditor-0.1.0/auditor/dashboard/app.py +191 -0
  34. ai_code_quality_auditor-0.1.0/auditor/dashboard/templates/index.html +139 -0
  35. ai_code_quality_auditor-0.1.0/auditor/dashboard/templates/report.html +484 -0
  36. ai_code_quality_auditor-0.1.0/auditor/governance/__init__.py +0 -0
  37. ai_code_quality_auditor-0.1.0/auditor/governance/compliance_checker.py +167 -0
  38. ai_code_quality_auditor-0.1.0/auditor/models/__init__.py +0 -0
  39. ai_code_quality_auditor-0.1.0/auditor/models/audit_result.py +29 -0
  40. ai_code_quality_auditor-0.1.0/auditor/reporting/__init__.py +0 -0
  41. ai_code_quality_auditor-0.1.0/auditor/reporting/csv_reporter.py +21 -0
  42. ai_code_quality_auditor-0.1.0/auditor/reporting/json_reporter.py +8 -0
  43. ai_code_quality_auditor-0.1.0/pyproject.toml +63 -0
  44. ai_code_quality_auditor-0.1.0/setup.cfg +4 -0
  45. ai_code_quality_auditor-0.1.0/tests/test_analyzers.py +42 -0
  46. ai_code_quality_auditor-0.1.0/tests/test_antigravity_adapter.py +40 -0
  47. ai_code_quality_auditor-0.1.0/tests/test_claude_code_adapter.py +59 -0
  48. ai_code_quality_auditor-0.1.0/tests/test_cli.py +64 -0
  49. ai_code_quality_auditor-0.1.0/tests/test_complexity_analyzer.py +53 -0
  50. ai_code_quality_auditor-0.1.0/tests/test_compliance_checker.py +116 -0
  51. ai_code_quality_auditor-0.1.0/tests/test_cursor_agent_adapter.py +41 -0
  52. ai_code_quality_auditor-0.1.0/tests/test_dashboard.py +51 -0
  53. ai_code_quality_auditor-0.1.0/tests/test_duplication_analyzer.py +39 -0
  54. ai_code_quality_auditor-0.1.0/tests/test_experiment.py +102 -0
  55. ai_code_quality_auditor-0.1.0/tests/test_hallucination_analyzer.py +34 -0
  56. ai_code_quality_auditor-0.1.0/tests/test_human_control_adapter.py +52 -0
  57. ai_code_quality_auditor-0.1.0/tests/test_human_control_recorder.py +28 -0
  58. ai_code_quality_auditor-0.1.0/tests/test_keystroke_analyzer.py +27 -0
  59. ai_code_quality_auditor-0.1.0/tests/test_manifest_deriver.py +37 -0
  60. ai_code_quality_auditor-0.1.0/tests/test_notebook_analysis.py +83 -0
  61. ai_code_quality_auditor-0.1.0/tests/test_replit_agent_adapter.py +41 -0
  62. ai_code_quality_auditor-0.1.0/tests/test_security_analyzer.py +36 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dominic Rume
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-code-quality-auditor
3
+ Version: 0.1.0
4
+ Summary: Empirical Safety Harness for agentic AI coding systems. Scores AI-generated code on 5 metrics across 5 vendor conditions against one fixed spec.
5
+ Author-email: Dominic Rume <dominicrume@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Dominic Rume
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor
29
+ Project-URL: Repository, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor
30
+ Project-URL: Issues, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/issues
31
+ Project-URL: Documentation, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/tree/main/docs
32
+ Keywords: ai,code-quality,llm,agents,evaluation,claude-code,cursor,sonarcloud,dissertation
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: Intended Audience :: Science/Research
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Topic :: Software Development :: Quality Assurance
42
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
43
+ Requires-Python: >=3.11
44
+ Description-Content-Type: text/markdown
45
+ License-File: LICENSE
46
+ Requires-Dist: pydantic>=2.0
47
+ Requires-Dist: pyyaml>=6.0
48
+ Requires-Dist: click>=8.1
49
+ Requires-Dist: rich>=13.0
50
+ Requires-Dist: radon>=6.0
51
+ Requires-Dist: python-dotenv>=1.0
52
+ Requires-Dist: bandit>=1.8
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest>=8.0; extra == "dev"
55
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
56
+ Requires-Dist: ruff>=0.5; extra == "dev"
57
+ Requires-Dist: build>=1.2; extra == "dev"
58
+ Requires-Dist: twine>=5.0; extra == "dev"
59
+ Provides-Extra: notebook
60
+ Requires-Dist: pandas>=2.0; extra == "notebook"
61
+ Requires-Dist: scipy>=1.10; extra == "notebook"
62
+ Requires-Dist: matplotlib>=3.7; extra == "notebook"
63
+ Requires-Dist: jupyter>=1.0; extra == "notebook"
64
+ Provides-Extra: dashboard
65
+ Requires-Dist: flask>=3.0; extra == "dashboard"
66
+ Provides-Extra: recorder
67
+ Requires-Dist: pynput>=1.7; extra == "recorder"
68
+ Provides-Extra: all
69
+ Requires-Dist: pytest>=8.0; extra == "all"
70
+ Requires-Dist: pandas>=2.0; extra == "all"
71
+ Requires-Dist: scipy>=1.10; extra == "all"
72
+ Requires-Dist: matplotlib>=3.7; extra == "all"
73
+ Requires-Dist: jupyter>=1.0; extra == "all"
74
+ Requires-Dist: flask>=3.0; extra == "all"
75
+ Requires-Dist: pynput>=1.7; extra == "all"
76
+ Dynamic: license-file
77
+
78
+ # AI Code Quality Auditor — the Referee Tool
79
+
80
+ [![CI](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml/badge.svg)](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml)
81
+ [![PyPI](https://img.shields.io/pypi/v/ai-code-quality-auditor.svg)](https://pypi.org/project/ai-code-quality-auditor/)
82
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
83
+ [![Live dashboard](https://img.shields.io/badge/live-dashboard-purple)](https://auditor-dashboard.fly.dev)
84
+
85
+ > An empirical Safety Harness for agentic AI coding systems.
86
+ > Quantifies where AI-assisted development fails at governance, security,
87
+ > and ethical alignment — *before* the code reaches production.
88
+
89
+ **🟢 Try it in 30 seconds:**
90
+ ```bash
91
+ pipx install ai-code-quality-auditor
92
+ auditor --help
93
+ ```
94
+
95
+ **🚀 Or wire it into your CI in 6 lines** (`.github/workflows/auditor.yml`):
96
+ ```yaml
97
+ jobs:
98
+ audit:
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+ - uses: dominicrume/NEW-enterprise-ai-code-quality-auditor@main
103
+ with:
104
+ run-id: ${{ github.run_id }}
105
+ conditions: claude_code,cursor_agent
106
+ ```
107
+
108
+ **📊 Live dashboard:** https://auditor-dashboard.fly.dev *(pending deploy — see below)*
109
+
110
+ This is the experimental instrument for the MSc dissertation
111
+ **"AI-Assisted Coding Assessment Tool: Evaluating LLM Performance, Governance,
112
+ and Security in an Agent Education System"** (Aston University, MSc AI &
113
+ Business Strategy). The same instrument is the working prototype for the
114
+ PhD extension at the Aston-Capgemini Centre of Excellence for Enterprise AI.
115
+
116
+ ---
117
+
118
+ ## What it does
119
+ Given a fixed specification (the "spec box"), the Auditor:
120
+ 1. Runs five experimental conditions against the same task (human control,
121
+ visualisation→Claude→Replit, Cursor IDE, autonomous agent).
122
+ 2. Captures every output and every interaction event.
123
+ 3. Scores each result on five empirical metrics: security vulnerability
124
+ density, cyclomatic complexity, code duplication, hallucination frequency
125
+ (features outside spec), and keystroke dynamics (correction frequency).
126
+ 4. Emits CSV/JSON reports for statistical comparison.
127
+
128
+ ## Quick start
129
+ ```bash
130
+ cp .env.example .env
131
+ pip install -e .
132
+ auditor run --spec specs/agent_education_system.yaml --workflow human_control
133
+ auditor report --out data/reports/
134
+ ```
135
+
136
+ ## Read in this order
137
+ 1. `docs/ARCHITECTURE.md` — how the pieces fit
138
+ 2. `docs/METHODOLOGY.md` — how an experiment is run
139
+ 3. `docs/METRICS.md` — what each metric means and how it's computed
140
+ 4. `docs/ETHICS.md` — GDPR, synthetic data, academic integrity
141
+ 5. `docs/DISSERTATION_LINKAGE.md` — which folder serves which proposal section
142
+ 6. `docs/ROADMAP.md` — the PhD extension (API security + enterprise risk)
143
+
144
+ ## Principles
145
+ - One analyzer per metric. One adapter per AI workflow. Single responsibility.
146
+ - The spec is data, not code — externalised in `specs/` for reproducibility.
147
+ - Synthetic data only. No PII, no proprietary corporate records, ever.
148
+ - Every analyzer has a test. Green tests = trustable experiment.
@@ -0,0 +1,71 @@
1
+ # AI Code Quality Auditor — the Referee Tool
2
+
3
+ [![CI](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml/badge.svg)](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/ai-code-quality-auditor.svg)](https://pypi.org/project/ai-code-quality-auditor/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
6
+ [![Live dashboard](https://img.shields.io/badge/live-dashboard-purple)](https://auditor-dashboard.fly.dev)
7
+
8
+ > An empirical Safety Harness for agentic AI coding systems.
9
+ > Quantifies where AI-assisted development fails at governance, security,
10
+ > and ethical alignment — *before* the code reaches production.
11
+
12
+ **🟢 Try it in 30 seconds:**
13
+ ```bash
14
+ pipx install ai-code-quality-auditor
15
+ auditor --help
16
+ ```
17
+
18
+ **🚀 Or wire it into your CI in 6 lines** (`.github/workflows/auditor.yml`):
19
+ ```yaml
20
+ jobs:
21
+ audit:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+ - uses: dominicrume/NEW-enterprise-ai-code-quality-auditor@main
26
+ with:
27
+ run-id: ${{ github.run_id }}
28
+ conditions: claude_code,cursor_agent
29
+ ```
30
+
31
+ **📊 Live dashboard:** https://auditor-dashboard.fly.dev *(pending deploy — see below)*
32
+
33
+ This is the experimental instrument for the MSc dissertation
34
+ **"AI-Assisted Coding Assessment Tool: Evaluating LLM Performance, Governance,
35
+ and Security in an Agent Education System"** (Aston University, MSc AI &
36
+ Business Strategy). The same instrument is the working prototype for the
37
+ PhD extension at the Aston-Capgemini Centre of Excellence for Enterprise AI.
38
+
39
+ ---
40
+
41
+ ## What it does
42
+ Given a fixed specification (the "spec box"), the Auditor:
43
+ 1. Runs five experimental conditions against the same task (human control,
44
+ visualisation→Claude→Replit, Cursor IDE, autonomous agent).
45
+ 2. Captures every output and every interaction event.
46
+ 3. Scores each result on five empirical metrics: security vulnerability
47
+ density, cyclomatic complexity, code duplication, hallucination frequency
48
+ (features outside spec), and keystroke dynamics (correction frequency).
49
+ 4. Emits CSV/JSON reports for statistical comparison.
50
+
51
+ ## Quick start
52
+ ```bash
53
+ cp .env.example .env
54
+ pip install -e .
55
+ auditor run --spec specs/agent_education_system.yaml --workflow human_control
56
+ auditor report --out data/reports/
57
+ ```
58
+
59
+ ## Read in this order
60
+ 1. `docs/ARCHITECTURE.md` — how the pieces fit
61
+ 2. `docs/METHODOLOGY.md` — how an experiment is run
62
+ 3. `docs/METRICS.md` — what each metric means and how it's computed
63
+ 4. `docs/ETHICS.md` — GDPR, synthetic data, academic integrity
64
+ 5. `docs/DISSERTATION_LINKAGE.md` — which folder serves which proposal section
65
+ 6. `docs/ROADMAP.md` — the PhD extension (API security + enterprise risk)
66
+
67
+ ## Principles
68
+ - One analyzer per metric. One adapter per AI workflow. Single responsibility.
69
+ - The spec is data, not code — externalised in `specs/` for reproducibility.
70
+ - Synthetic data only. No PII, no proprietary corporate records, ever.
71
+ - Every analyzer has a test. Green tests = trustable experiment.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: ai-code-quality-auditor
3
+ Version: 0.1.0
4
+ Summary: Empirical Safety Harness for agentic AI coding systems. Scores AI-generated code on 5 metrics across 5 vendor conditions against one fixed spec.
5
+ Author-email: Dominic Rume <dominicrume@gmail.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 Dominic Rume
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor
29
+ Project-URL: Repository, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor
30
+ Project-URL: Issues, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/issues
31
+ Project-URL: Documentation, https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/tree/main/docs
32
+ Keywords: ai,code-quality,llm,agents,evaluation,claude-code,cursor,sonarcloud,dissertation
33
+ Classifier: Development Status :: 4 - Beta
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: Intended Audience :: Science/Research
36
+ Classifier: License :: OSI Approved :: MIT License
37
+ Classifier: Operating System :: OS Independent
38
+ Classifier: Programming Language :: Python :: 3.11
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Programming Language :: Python :: 3.13
41
+ Classifier: Topic :: Software Development :: Quality Assurance
42
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
43
+ Requires-Python: >=3.11
44
+ Description-Content-Type: text/markdown
45
+ License-File: LICENSE
46
+ Requires-Dist: pydantic>=2.0
47
+ Requires-Dist: pyyaml>=6.0
48
+ Requires-Dist: click>=8.1
49
+ Requires-Dist: rich>=13.0
50
+ Requires-Dist: radon>=6.0
51
+ Requires-Dist: python-dotenv>=1.0
52
+ Requires-Dist: bandit>=1.8
53
+ Provides-Extra: dev
54
+ Requires-Dist: pytest>=8.0; extra == "dev"
55
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
56
+ Requires-Dist: ruff>=0.5; extra == "dev"
57
+ Requires-Dist: build>=1.2; extra == "dev"
58
+ Requires-Dist: twine>=5.0; extra == "dev"
59
+ Provides-Extra: notebook
60
+ Requires-Dist: pandas>=2.0; extra == "notebook"
61
+ Requires-Dist: scipy>=1.10; extra == "notebook"
62
+ Requires-Dist: matplotlib>=3.7; extra == "notebook"
63
+ Requires-Dist: jupyter>=1.0; extra == "notebook"
64
+ Provides-Extra: dashboard
65
+ Requires-Dist: flask>=3.0; extra == "dashboard"
66
+ Provides-Extra: recorder
67
+ Requires-Dist: pynput>=1.7; extra == "recorder"
68
+ Provides-Extra: all
69
+ Requires-Dist: pytest>=8.0; extra == "all"
70
+ Requires-Dist: pandas>=2.0; extra == "all"
71
+ Requires-Dist: scipy>=1.10; extra == "all"
72
+ Requires-Dist: matplotlib>=3.7; extra == "all"
73
+ Requires-Dist: jupyter>=1.0; extra == "all"
74
+ Requires-Dist: flask>=3.0; extra == "all"
75
+ Requires-Dist: pynput>=1.7; extra == "all"
76
+ Dynamic: license-file
77
+
78
+ # AI Code Quality Auditor — the Referee Tool
79
+
80
+ [![CI](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml/badge.svg)](https://github.com/dominicrume/NEW-enterprise-ai-code-quality-auditor/actions/workflows/ci.yml)
81
+ [![PyPI](https://img.shields.io/pypi/v/ai-code-quality-auditor.svg)](https://pypi.org/project/ai-code-quality-auditor/)
82
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
83
+ [![Live dashboard](https://img.shields.io/badge/live-dashboard-purple)](https://auditor-dashboard.fly.dev)
84
+
85
+ > An empirical Safety Harness for agentic AI coding systems.
86
+ > Quantifies where AI-assisted development fails at governance, security,
87
+ > and ethical alignment — *before* the code reaches production.
88
+
89
+ **🟢 Try it in 30 seconds:**
90
+ ```bash
91
+ pipx install ai-code-quality-auditor
92
+ auditor --help
93
+ ```
94
+
95
+ **🚀 Or wire it into your CI in 6 lines** (`.github/workflows/auditor.yml`):
96
+ ```yaml
97
+ jobs:
98
+ audit:
99
+ runs-on: ubuntu-latest
100
+ steps:
101
+ - uses: actions/checkout@v4
102
+ - uses: dominicrume/NEW-enterprise-ai-code-quality-auditor@main
103
+ with:
104
+ run-id: ${{ github.run_id }}
105
+ conditions: claude_code,cursor_agent
106
+ ```
107
+
108
+ **📊 Live dashboard:** https://auditor-dashboard.fly.dev *(pending deploy — see below)*
109
+
110
+ This is the experimental instrument for the MSc dissertation
111
+ **"AI-Assisted Coding Assessment Tool: Evaluating LLM Performance, Governance,
112
+ and Security in an Agent Education System"** (Aston University, MSc AI &
113
+ Business Strategy). The same instrument is the working prototype for the
114
+ PhD extension at the Aston-Capgemini Centre of Excellence for Enterprise AI.
115
+
116
+ ---
117
+
118
+ ## What it does
119
+ Given a fixed specification (the "spec box"), the Auditor:
120
+ 1. Runs five experimental conditions against the same task (human control,
121
+ visualisation→Claude→Replit, Cursor IDE, autonomous agent).
122
+ 2. Captures every output and every interaction event.
123
+ 3. Scores each result on five empirical metrics: security vulnerability
124
+ density, cyclomatic complexity, code duplication, hallucination frequency
125
+ (features outside spec), and keystroke dynamics (correction frequency).
126
+ 4. Emits CSV/JSON reports for statistical comparison.
127
+
128
+ ## Quick start
129
+ ```bash
130
+ cp .env.example .env
131
+ pip install -e .
132
+ auditor run --spec specs/agent_education_system.yaml --workflow human_control
133
+ auditor report --out data/reports/
134
+ ```
135
+
136
+ ## Read in this order
137
+ 1. `docs/ARCHITECTURE.md` — how the pieces fit
138
+ 2. `docs/METHODOLOGY.md` — how an experiment is run
139
+ 3. `docs/METRICS.md` — what each metric means and how it's computed
140
+ 4. `docs/ETHICS.md` — GDPR, synthetic data, academic integrity
141
+ 5. `docs/DISSERTATION_LINKAGE.md` — which folder serves which proposal section
142
+ 6. `docs/ROADMAP.md` — the PhD extension (API security + enterprise risk)
143
+
144
+ ## Principles
145
+ - One analyzer per metric. One adapter per AI workflow. Single responsibility.
146
+ - The spec is data, not code — externalised in `specs/` for reproducibility.
147
+ - Synthetic data only. No PII, no proprietary corporate records, ever.
148
+ - Every analyzer has a test. Green tests = trustable experiment.
@@ -0,0 +1,60 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ ai_code_quality_auditor.egg-info/PKG-INFO
5
+ ai_code_quality_auditor.egg-info/SOURCES.txt
6
+ ai_code_quality_auditor.egg-info/dependency_links.txt
7
+ ai_code_quality_auditor.egg-info/entry_points.txt
8
+ ai_code_quality_auditor.egg-info/requires.txt
9
+ ai_code_quality_auditor.egg-info/top_level.txt
10
+ auditor/__init__.py
11
+ auditor/adapters/__init__.py
12
+ auditor/adapters/antigravity_adapter.py
13
+ auditor/adapters/base_adapter.py
14
+ auditor/adapters/claude_code_adapter.py
15
+ auditor/adapters/cursor_agent_adapter.py
16
+ auditor/adapters/human_control_adapter.py
17
+ auditor/adapters/human_control_recorder.py
18
+ auditor/adapters/replit_agent_adapter.py
19
+ auditor/analyzers/__init__.py
20
+ auditor/analyzers/complexity_analyzer.py
21
+ auditor/analyzers/duplication_analyzer.py
22
+ auditor/analyzers/hallucination_analyzer.py
23
+ auditor/analyzers/keystroke_analyzer.py
24
+ auditor/analyzers/manifest_deriver.py
25
+ auditor/analyzers/security_analyzer.py
26
+ auditor/core/__init__.py
27
+ auditor/core/cli.py
28
+ auditor/core/config.py
29
+ auditor/core/experiment.py
30
+ auditor/core/logger.py
31
+ auditor/core/runner.py
32
+ auditor/dashboard/__init__.py
33
+ auditor/dashboard/app.py
34
+ auditor/dashboard/templates/index.html
35
+ auditor/dashboard/templates/report.html
36
+ auditor/governance/__init__.py
37
+ auditor/governance/compliance_checker.py
38
+ auditor/models/__init__.py
39
+ auditor/models/audit_result.py
40
+ auditor/reporting/__init__.py
41
+ auditor/reporting/csv_reporter.py
42
+ auditor/reporting/json_reporter.py
43
+ tests/test_analyzers.py
44
+ tests/test_antigravity_adapter.py
45
+ tests/test_claude_code_adapter.py
46
+ tests/test_cli.py
47
+ tests/test_complexity_analyzer.py
48
+ tests/test_compliance_checker.py
49
+ tests/test_cursor_agent_adapter.py
50
+ tests/test_dashboard.py
51
+ tests/test_duplication_analyzer.py
52
+ tests/test_experiment.py
53
+ tests/test_hallucination_analyzer.py
54
+ tests/test_human_control_adapter.py
55
+ tests/test_human_control_recorder.py
56
+ tests/test_keystroke_analyzer.py
57
+ tests/test_manifest_deriver.py
58
+ tests/test_notebook_analysis.py
59
+ tests/test_replit_agent_adapter.py
60
+ tests/test_security_analyzer.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ auditor = auditor.core.cli:main
@@ -0,0 +1,35 @@
1
+ pydantic>=2.0
2
+ pyyaml>=6.0
3
+ click>=8.1
4
+ rich>=13.0
5
+ radon>=6.0
6
+ python-dotenv>=1.0
7
+ bandit>=1.8
8
+
9
+ [all]
10
+ pytest>=8.0
11
+ pandas>=2.0
12
+ scipy>=1.10
13
+ matplotlib>=3.7
14
+ jupyter>=1.0
15
+ flask>=3.0
16
+ pynput>=1.7
17
+
18
+ [dashboard]
19
+ flask>=3.0
20
+
21
+ [dev]
22
+ pytest>=8.0
23
+ pytest-asyncio>=0.23
24
+ ruff>=0.5
25
+ build>=1.2
26
+ twine>=5.0
27
+
28
+ [notebook]
29
+ pandas>=2.0
30
+ scipy>=1.10
31
+ matplotlib>=3.7
32
+ jupyter>=1.0
33
+
34
+ [recorder]
35
+ pynput>=1.7
File without changes
@@ -0,0 +1,139 @@
1
+ """antigravity adapter — vendor: Google Gemini Antigravity.
2
+
3
+ Drives the Antigravity agent CLI against the spec, captures its streamed
4
+ agent events, and reads the produced codebase from the work_dir.
5
+
6
+ Capture contract: see docs/METHODOLOGY.md. Antigravity is agentic, so every
7
+ captured event maps to ``agent_action``.
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ import shutil
13
+ import subprocess
14
+ from pathlib import Path
15
+ from typing import Callable, Iterable
16
+
17
+ from auditor.adapters.base_adapter import BaseAdapter
18
+ from auditor.core.config import settings
19
+
20
+
21
+ _CODE_SUFFIXES = {".py", ".js", ".ts", ".tsx", ".jsx", ".go", ".rs", ".java",
22
+ ".rb", ".sql", ".yaml", ".yml", ".toml", ".md"}
23
+
24
+ Runner = Callable[[str, Path], Iterable[dict]]
25
+
26
+
27
+ def _default_runner(prompt: str, work_dir: Path, cli: str = "antigravity",
28
+ timeout: int = 600) -> list[dict]:
29
+ proc = subprocess.run(
30
+ [cli, "run", "--prompt", prompt, "--format", "jsonl"],
31
+ cwd=str(work_dir), capture_output=True, text=True,
32
+ timeout=timeout, check=False,
33
+ )
34
+ events: list[dict] = []
35
+ for line in proc.stdout.splitlines():
36
+ line = line.strip()
37
+ if not line:
38
+ continue
39
+ try:
40
+ events.append(json.loads(line))
41
+ except json.JSONDecodeError:
42
+ continue
43
+ return events
44
+
45
+
46
+ def _build_prompt(spec: dict) -> str:
47
+ return (
48
+ "Build the following specification in the current working directory. "
49
+ "Implement only the listed features.\n\n"
50
+ f"SPEC:\n{json.dumps(spec, indent=2)}\n"
51
+ )
52
+
53
+
54
+ def _to_contract_events(raw_events: Iterable[dict]) -> list[dict]:
55
+ out: list[dict] = []
56
+ for ev in raw_events:
57
+ out.append({
58
+ "type": "agent_action",
59
+ "subtype": ev.get("kind") or ev.get("type"),
60
+ "detail": ev.get("phase") or ev.get("status"),
61
+ "tool": ev.get("tool") or ev.get("action"),
62
+ })
63
+ return out
64
+
65
+
66
+ def _load_codebase(work_dir: Path) -> dict:
67
+ work_dir = Path(work_dir)
68
+ if not work_dir.is_dir():
69
+ raise FileNotFoundError(f"work_dir not found: {work_dir}")
70
+ _EXCLUDE_DIRS = {".venv", "venv", "env", "__pycache__", "node_modules",
71
+ ".pytest_cache", ".git", "site-packages", "dist", "build",
72
+ ".mypy_cache", ".ruff_cache", "egg-info"}
73
+ files: dict[str, str] = {}
74
+ for path in sorted(work_dir.rglob("*")):
75
+ if not path.is_file() or path.name == "manifest.json":
76
+ continue
77
+ if path.suffix not in _CODE_SUFFIXES:
78
+ continue
79
+ if any(part in _EXCLUDE_DIRS or part.endswith(".egg-info")
80
+ for part in path.relative_to(work_dir).parts):
81
+ continue
82
+ files[path.relative_to(work_dir).as_posix()] = path.read_text(encoding="utf-8")
83
+ manifest_path = work_dir / "manifest.json"
84
+ manifest = json.loads(manifest_path.read_text()) if manifest_path.exists() else []
85
+ return {"files": files, "manifest": manifest}
86
+
87
+
88
+ class AntigravityAdapter(BaseAdapter):
89
+ name = "antigravity"
90
+
91
+ def __init__(self, work_dir: str | Path, cli: str = "antigravity",
92
+ run_id: str | None = None, raw_root: str | Path = "data/raw",
93
+ runner: Runner | None = None, timeout: int = 600,
94
+ replay_dir: str | Path | None = None):
95
+ """
96
+ replay_dir: if given, skip the CLI and load codebase from this folder
97
+ plus an interaction log from ``<replay_dir>/log.json``. Use this to
98
+ score sessions captured manually in the Antigravity web IDE.
99
+ """
100
+ self.work_dir = Path(work_dir)
101
+ self.cli = cli
102
+ self.run_id = run_id or settings.run_id
103
+ self.raw_root = Path(raw_root)
104
+ self.timeout = timeout
105
+ self.replay_dir = Path(replay_dir) if replay_dir else None
106
+ self._runner: Runner = runner or (
107
+ lambda prompt, wd: _default_runner(prompt, wd, cli=self.cli, timeout=self.timeout)
108
+ )
109
+
110
+ def _persist(self, codebase, interaction_log, raw_events) -> Path:
111
+ dest = self.raw_root / self.run_id / self.name
112
+ dest.mkdir(parents=True, exist_ok=True)
113
+ (dest / "codebase.json").write_text(json.dumps(codebase, indent=2))
114
+ (dest / "interaction_log.json").write_text(json.dumps(interaction_log, indent=2))
115
+ (dest / "raw_stream.json").write_text(json.dumps(raw_events, indent=2))
116
+ code_copy = dest / "code"
117
+ if code_copy.exists():
118
+ shutil.rmtree(code_copy)
119
+ source = self.replay_dir if self.replay_dir is not None else self.work_dir
120
+ if source.exists():
121
+ shutil.copytree(source, code_copy)
122
+ return dest
123
+
124
+ def generate(self, spec: dict) -> tuple[dict, list[dict]]:
125
+ if self.replay_dir is not None:
126
+ codebase = _load_codebase(self.replay_dir)
127
+ log_path = self.replay_dir / "log.json"
128
+ interaction_log = (
129
+ json.loads(log_path.read_text()) if log_path.exists() else []
130
+ )
131
+ self._persist(codebase, interaction_log, raw_events=[])
132
+ return codebase, interaction_log
133
+ self.work_dir.mkdir(parents=True, exist_ok=True)
134
+ prompt = _build_prompt(spec)
135
+ raw_events = list(self._runner(prompt, self.work_dir))
136
+ interaction_log = _to_contract_events(raw_events)
137
+ codebase = _load_codebase(self.work_dir)
138
+ self._persist(codebase, interaction_log, raw_events)
139
+ return codebase, interaction_log
@@ -0,0 +1,14 @@
1
+ """Base contract every AI workflow adapter implements."""
2
+ from abc import ABC, abstractmethod
3
+
4
+
5
+ class BaseAdapter(ABC):
6
+ name: str
7
+
8
+ @abstractmethod
9
+ def generate(self, spec: dict) -> tuple[dict, list[dict]]:
10
+ """Return (codebase, interaction_log).
11
+
12
+ codebase: {"files": {path: content}, "manifest": [feature_ids...]}
13
+ interaction_log: list of events with at minimum a "type" key.
14
+ """