fixfirst 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 (37) hide show
  1. fixfirst-0.1.0/.coverage +0 -0
  2. fixfirst-0.1.0/.gitignore +5 -0
  3. fixfirst-0.1.0/.ruff.toml +2 -0
  4. fixfirst-0.1.0/AGENTS.md +48 -0
  5. fixfirst-0.1.0/IDEA.md +123 -0
  6. fixfirst-0.1.0/LICENSE +202 -0
  7. fixfirst-0.1.0/PKG-INFO +63 -0
  8. fixfirst-0.1.0/README.md +48 -0
  9. fixfirst-0.1.0/ROADMAP.md +176 -0
  10. fixfirst-0.1.0/docs/adr/0001-record-architecture-decisions.md +17 -0
  11. fixfirst-0.1.0/docs/adr/0002-agent-only-gate-via-git-shim.md +55 -0
  12. fixfirst-0.1.0/docs/adr/0003-configs-read-from-git.md +50 -0
  13. fixfirst-0.1.0/docs/adr/0004-native-configs-explicit-flags.md +33 -0
  14. fixfirst-0.1.0/docs/adr/0005-policy-as-pytest-plugin.md +45 -0
  15. fixfirst-0.1.0/docs/adr/0006-ruff-default-rest-opt-in.md +35 -0
  16. fixfirst-0.1.0/docs/adr/0007-suppressions-judged-against-base.md +82 -0
  17. fixfirst-0.1.0/docs/adr/0008-only-new-problems-in-changed-lines.md +26 -0
  18. fixfirst-0.1.0/docs/adr/0009-output-contract.md +30 -0
  19. fixfirst-0.1.0/docs/adr/0010-harness-integration-via-claude-hook-format.md +49 -0
  20. fixfirst-0.1.0/docs/adr/0011-failure-modes-and-stop-cap.md +55 -0
  21. fixfirst-0.1.0/docs/adr/0012-threat-model.md +29 -0
  22. fixfirst-0.1.0/docs/adr/0013-trust-before-running-tests.md +43 -0
  23. fixfirst-0.1.0/docs/adr/0014-performance-budgets.md +38 -0
  24. fixfirst-0.1.0/docs/adr/0015-python-only.md +16 -0
  25. fixfirst-0.1.0/docs/adr/0016-distribution-pypi-trusted-publishing.md +72 -0
  26. fixfirst-0.1.0/docs/adr/0017-public-code-no-public-maintenance.md +22 -0
  27. fixfirst-0.1.0/docs/adr/0018-build-own-narrow-core.md +30 -0
  28. fixfirst-0.1.0/docs/adr/0019-name-fixfirst.md +17 -0
  29. fixfirst-0.1.0/docs/adr/0020-policy-plugin-injected-by-gate.md +60 -0
  30. fixfirst-0.1.0/docs/adr/README.md +26 -0
  31. fixfirst-0.1.0/pyproject.toml +25 -0
  32. fixfirst-0.1.0/src/fixfirst/__init__.py +1 -0
  33. fixfirst-0.1.0/src/fixfirst/__main__.py +3 -0
  34. fixfirst-0.1.0/src/fixfirst/cli.py +777 -0
  35. fixfirst-0.1.0/src/fixfirst/data/git-shim.sh +28 -0
  36. fixfirst-0.1.0/src/fixfirst/data/hooks.json +6 -0
  37. fixfirst-0.1.0/src/fixfirst/policy.py +217 -0
Binary file
@@ -0,0 +1,5 @@
1
+ .venv/
2
+ __pycache__/
3
+ dist/
4
+ .ruff_cache/
5
+ uv.lock
@@ -0,0 +1,2 @@
1
+ line-length = 120
2
+ target-version = "py311"
@@ -0,0 +1,48 @@
1
+ # CLAUDE.md — working on fixfirst
2
+
3
+ Read first: `IDEA.md` (intention), `ROADMAP.md` (what to build next), `docs/adr/` (why).
4
+ Current target: **MVP-1** in `ROADMAP.md`.
5
+
6
+ ## Ground rules
7
+ - Python only. No TypeScript, no Node adapters (ADR-0010, ADR-0015).
8
+ - Every decision that changes an ADR gets a new or updated ADR in MADR format, with the facts it
9
+ rests on (test output, cited docs). Do not silently deviate.
10
+ - Claims about tool behaviour (ruff, ty, pytest, harnesses) are tested before they are written down.
11
+ - Output contract (ADR-0009): one line per problem, silent on success. Keep the gate quiet.
12
+ - Never gate the human; never delete user files; never rewrite files outside the agent's changes.
13
+
14
+ ## Repository layout (target)
15
+ ```
16
+ src/fixfirst/cli.py # check / verify / hook / install / env / doctor
17
+ src/fixfirst/policy.py # pytest plugin; copied + injected by the gate as fixfirst_gate (ADR-0020), no entry point
18
+ src/fixfirst/data/ # git-shim.sh, hooks.json
19
+ src/fixfirst/policy.py is never imported by the CLI (pytest lives in the project venv, not the CLI's)
20
+ docs/adr/ # decisions
21
+ reference/ # NOT shipped: prototype + originals for porting
22
+ ```
23
+
24
+ ## Reference material (`reference/`, do not ship)
25
+ - `pyguard-0.2/` — working prototype (tested). Port from here; rename `pyguard` → `fixfirst`.
26
+ Its `opencode.ts`, `pi.ts`, Hermes plugin are superseded by ADR-0010 — do not port them.
27
+ - `conftest-original.py` — the maintainer's original policy conftest (source of policy semantics).
28
+ - `fixfirst-setup/` — `release.yml` (Trusted Publishing) and `pyproject.toml` template.
29
+ - `scripts/attack-scenarios.sh [cli]` — regression: agent shortcuts against `<cli> verify`, plus a
30
+ PASS controls (clean, legacy, zero-config), every ADR-0007 suppression form, shim and hooks.
31
+ 63/63 with fixfirst 0.1.0. Must keep passing. Use errors ruff cannot autofix (`verify` autofixes).
32
+
33
+ ## Commands
34
+ ```bash
35
+ uv tool install --force . # install CLI from checkout
36
+ reference/scripts/attack-scenarios.sh fixfirst
37
+ uvx ruff check src && uvx ruff format --check src
38
+ ```
39
+
40
+ ## Git (public repo, pseudonymous)
41
+ - Commit messages carry no session trailers: no `Co-Authored-By`, no `Claude-Session` link.
42
+ - Commit identity: the pseudonym with its GitHub noreply address (set in `git config`), never a real
43
+ name. Check with `git log --format='%an <%ae>'` before pushing.
44
+ - Never write the employer, internal hosts or group names into the repo.
45
+
46
+ ## Maintainer preferences
47
+ - One concrete recommendation, not a menu. Research first, then decide, then full instructions.
48
+ - Plain, direct writing. State reasons and evidence; do not just agree.
fixfirst-0.1.0/IDEA.md ADDED
@@ -0,0 +1,123 @@
1
+ # fixfirst — Idea and Intention
2
+
3
+ > One gate that only the agent hits: in any harness it has to fix what it broke instead of
4
+ > cheating around ruff and the checks you switch on. Configured only by your existing rules,
5
+ > installed in one command, fast, offline, and so quiet the model only ever sees the bug.
6
+
7
+ Status: 2026-11-14, pre-MVP-1. Working name `pyguard` (taken on PyPI) → final name `fixfirst`.
8
+
9
+ ## 1. Starting point
10
+
11
+ The maintainer runs Python repos (12+, growing) with coding agents (OpenCode server with
12
+ long-lived sessions, Hermes, pi, Claude Code, Codex; mostly local models).
13
+
14
+ Current setup per repo:
15
+
16
+ - `tests/conftest.py` holds the policy: ruff with `--ignore-noqa` (superseded: flags committed
17
+ suppressions in legacy files; fixfirst judges suppressions against the base instead, ADR-0007), ty, per-file coverage on
18
+ touched files, Hypothesis evidence for numerical code (boundary = TID251 per-file-ignores in
19
+ the ruff config), no code in `.tmp/`.
20
+ - `chattr +i` on `conftest.py`, `ruff.toml`, `ty.toml`.
21
+
22
+ It works, but: maintaining one conftest per repo across 12+ repos is a mess, and the agent
23
+ still finds ways around it.
24
+
25
+ ## 2. The real problem
26
+
27
+ The agent takes the path of least effort. Instead of fixing code it:
28
+
29
+ - writes alternative configs (`.ruff.toml`, nested `ruff.toml`, `[tool.ruff]`, `pytest.ini`),
30
+ - builds its own conftest (observed: a root `conftest.py` to circumvent the one in `tests/`),
31
+ - adds suppression comments (`noqa`, `ty: ignore`, `ruff: ignore`, `--add-ignore` …),
32
+ - writes a lot without running ruff in between,
33
+ - does not commit or does not run pytest, so the conftest-based checks never run.
34
+
35
+ Holes we reproduced against the conftest + chattr setup (all closed by the v0.2 prototype):
36
+
37
+ | Shortcut | Why it worked |
38
+ |---|---|
39
+ | root `.ruff.toml` with `select = []` | ruff prefers `.ruff.toml` over `ruff.toml` |
40
+ | nested `src/pkg/ruff.toml` | ruff uses the nearest config per directory |
41
+ | `# ty: ignore[...]`, `ty check --add-ignore` | ty has no `--ignore-noqa`; `respect-type-ignore-comments=false` only covers `type: ignore` |
42
+ | new module without any test | never imported → never measured → "untouched" |
43
+ | `pytest other/`, `pytest file.py` outside `tests/` | `tests/conftest.py` is not loaded |
44
+ | `--noconftest`, `PYTEST_ADDOPTS`, `addopts`, new `pytest.ini` | policy silently disabled |
45
+ | agent conftest with hooks / overriding fixtures | runs in the same test process |
46
+ | staged config change via `git hash-object` + `update-index` | `chattr` protects the file, not the index |
47
+
48
+ ## 3. Intention (agreed, latest)
49
+
50
+ 1. **Enforced on the agent only.** Checks apply to everything the agent does — while it works
51
+ and before its work counts as done or is committed. The human is never gated: no shim in the
52
+ human's shell or IDE git; the human runs pytest voluntarily. CI only confirms, it does not
53
+ correct late.
54
+ 2. **No pre-commit hook.** It would gate the human and is easy for the agent to skip.
55
+ 3. **Harness-agnostic.** Same behaviour in OpenCode (server, long-lived sessions), Hermes, pi,
56
+ Claude Code and Codex, without a separate solution per tool. Covered harness versions are
57
+ tested and documented.
58
+ 4. **Ruff always on, everything else opt-in** through the committed config: ty, coverage,
59
+ Hypothesis evidence, bandit (ruff `S`). **Suppression comments the agent adds never count**
60
+ (noqa, `ruff: ignore`/`disable`/`file-ignore`, type/ty/pyright ignore, nosec,
61
+ `pragma: no cover`, `fmt: off/skip`) — always, in every repo. Suppressions already committed
62
+ stay valid. Exclusions for false positives live in the committed config.
63
+ 5. **Judge only what the agent changed.** Existing problems in an old repo never block; only new
64
+ problems vs. the base count. Autofix touches only files the agent changed, never the whole
65
+ repo, never mid-edit.
66
+ 6. **Native configs as single source of truth**, read from git: `.ruff.toml`, `ty.toml`,
67
+ coverage and pytest config. No own config format, no renaming/"fixing" of user files, no
68
+ silent deletions — report, don't clean up.
69
+ 7. **Minimal manual setup.** The only manual work is writing your rules. Install + harness
70
+ wiring is one command with dry-run, uninstall, idempotent. Lint/type checks run everywhere;
71
+ tests (they execute repo code) run only in trusted repos, trust defined once by pattern.
72
+ 8. **Minimal output.** One line per problem (`file:line: rule message`), nothing on success;
73
+ `-v` for raw output, `--format json` for tools.
74
+ 9. **Fast and bounded.** Per-edit check < 100 ms when nothing changed; stop/retry loops capped.
75
+ 10. **Local and deterministic.** No network at runtime, no telemetry, no LLM calls; installed once
76
+ from a pinned, signed release; works air-gapped.
77
+ 11. **Honest about limits.** Stops lazy agents, not hostile ones. Root agents, direct
78
+ `/usr/bin/git`, and sabotage from inside test code are documented limits; the boundary there
79
+ is CODEOWNERS, protected branches and CI.
80
+ 12. **Release-ready.** Public PyPI project `fixfirst`, installable through Artifactory/Xray and in
81
+ public projects; Apache-2.0; changelog; semver; 60-second demo.
82
+
83
+ Underneath: the maintainer tests whether arguments are evaluated or just conceded. Docs and
84
+ decisions must state reasons and facts, not agreement.
85
+
86
+ ## 4. Value over conftest + chattr
87
+
88
+ | | conftest + chattr | fixfirst |
89
+ |---|---|---|
90
+ | Feedback to the agent | only when it runs pytest | after every tool call, changed files |
91
+ | "Done" enforced | only if the agent runs pytest | at Stop and at every commit |
92
+ | Tested holes (section 2) | open | closed |
93
+ | Setup per repo | copy conftest, chattr (sudo), unlock/relock per change | nothing beyond ruff/ty config |
94
+ | Policy change | in every repo | one version bump |
95
+ | Cloud/containers | chattr unavailable | works (config from git) |
96
+ | Output to the model | conftest logs, coverage tables | one line per problem |
97
+
98
+ Not gained: smarter checks (same policy logic), protection against hostile agents.
99
+ Cost: several weekends to build; ongoing upkeep for ruff/ty suppression forms and harness changes.
100
+
101
+ ## 5. Competition (researched 2026-11-14)
102
+
103
+ No tool covers the intention. Closest:
104
+
105
+ | Tool | Covers | Missing |
106
+ |---|---|---|
107
+ | **cagr** (KrtinShet/cagr, TS/Bun, 0 stars) | suppression guard, changed-files lint, stop gate (max 2 blocks), time budgets, quiet output, honest framing, reviewer-agent PR gate | only Claude Code + Codex natively (others via git hooks only), shell edits invisible (`sed -i`, `cat >`), config read from disk and `ConfigError` fails open, git hooks gate humans too, no coverage/Hypothesis |
108
+ | klasp | commit gate per agent | per-agent mechanisms, no OpenCode, no config protection |
109
+ | oh-my-harness | commit/stop test gate, lint-on-save | Claude Code/Codex/Pi only, eslint-centric |
110
+ | agent-guardrails | deterministic hooks, config tampering | Claude Code + Codex |
111
+ | anti-slop-py | flags agents silencing type checkers | judges comments, not "new vs base"; coded suppressions allowed |
112
+ | TDD Guard | pytest TDD enforcement | Claude Code only |
113
+ | agentic-git | PATH shim for git | git safety only |
114
+
115
+ Ideas adopted from cagr: stop cap, time budgets + `doctor`, every block says what to do instead,
116
+ fail-open only for internal errors.
117
+
118
+ ## 6. Constraints
119
+
120
+ - One-man show: maintenance must stay small. Pure Python, no TypeScript.
121
+ - Private repo; code public through PyPI. Later a clean public repo, no public maintenance (ADR-0016, ADR-0017).
122
+ - Pseudonymous publishing identity (GitHub org `fixfirst-sh`).
123
+ - Must pass JFrog Artifactory + Xray (+ possibly Curation) in corporate environments.
fixfirst-0.1.0/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.5
2
+ Name: fixfirst
3
+ Version: 0.1.0
4
+ Summary: Makes coding agents fix their code instead of cheating around ruff, ty and your tests
5
+ Author: fixfirst contributors
6
+ License-Expression: Apache-2.0
7
+ License-File: LICENSE
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Topic :: Software Development :: Quality Assurance
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: ruff==0.17.5
13
+ Requires-Dist: ty==0.0.104
14
+ Description-Content-Type: text/markdown
15
+
16
+ # fixfirst
17
+
18
+ Makes coding agents fix their code instead of cheating around ruff, ty and your tests.
19
+ One gate that only the agent hits, configured only by your committed rules, one line per problem,
20
+ silent on success. Status: alpha (0.1.0). Design: `IDEA.md`, `docs/adr/`.
21
+
22
+ ## Setup (once per machine)
23
+
24
+ ```bash
25
+ uv tool install fixfirst
26
+ fixfirst install # git shim + hooks for Claude Code (~/.claude) and Codex (~/.codex)
27
+ ```
28
+
29
+ In each harness launcher or systemd unit — **not** in your own shell:
30
+
31
+ ```bash
32
+ eval "$(fixfirst env)" # git shim first on the agent's PATH
33
+ export FIXFIRST_TRUST="gitlab.example.com/mygroup/*" # repos whose tests may run (host/path)
34
+ ```
35
+
36
+ Per repo: nothing. The project needs a `.venv` (`uv sync`) with pytest, plus pytest-cov / hypothesis
37
+ if you switch those policies on. `fixfirst doctor` shows the wiring, the base and the trust status.
38
+
39
+ ## What runs
40
+
41
+ | check | on when (committed config) |
42
+ |---|---|
43
+ | ruff | always; `.ruff.toml` / `ruff.toml` / `[tool.ruff]`, else ruff defaults |
44
+ | bandit | ruff `S` rules selected |
45
+ | ty | `ty.toml` exists |
46
+ | coverage | coverage `fail_under` set; per touched/changed file |
47
+ | Hypothesis evidence | TID251 per-file-ignores in the ruff config (numerical boundary) |
48
+ | tests | `tests/` or a pytest config exists, and the origin matches `FIXFIRST_TRUST` |
49
+ | suppressions | always: any `noqa`, `type/ty/pyright: ignore`, `nosec`, `pragma: no cover`, `fmt: off/skip` … not present at the base |
50
+
51
+ Config is read from git (`HEAD`), never from disk: agent edits to config have no effect and block
52
+ its commit. Only changed files are checked, so old problems in untouched files never block.
53
+
54
+ When: after every agent tool call (changed files, report only), when the agent stops, and on every
55
+ `git commit` through the shim (autofix of changed files, then everything). CI:
56
+ `fixfirst verify --ci origin/<target>`.
57
+
58
+ Limits: stops lazy agents, not hostile ones — root agents, `/usr/bin/git` and sabotage from test
59
+ code are out of scope (ADR-0012). Protect `main` with CI and CODEOWNERS.
60
+
61
+ ## Source and contributions
62
+ Apache-2.0. The source ships in the package on PyPI; development happens in a private repository,
63
+ so there is no public issue tracker and no pull requests.
@@ -0,0 +1,48 @@
1
+ # fixfirst
2
+
3
+ Makes coding agents fix their code instead of cheating around ruff, ty and your tests.
4
+ One gate that only the agent hits, configured only by your committed rules, one line per problem,
5
+ silent on success. Status: alpha (0.1.0). Design: `IDEA.md`, `docs/adr/`.
6
+
7
+ ## Setup (once per machine)
8
+
9
+ ```bash
10
+ uv tool install fixfirst
11
+ fixfirst install # git shim + hooks for Claude Code (~/.claude) and Codex (~/.codex)
12
+ ```
13
+
14
+ In each harness launcher or systemd unit — **not** in your own shell:
15
+
16
+ ```bash
17
+ eval "$(fixfirst env)" # git shim first on the agent's PATH
18
+ export FIXFIRST_TRUST="gitlab.example.com/mygroup/*" # repos whose tests may run (host/path)
19
+ ```
20
+
21
+ Per repo: nothing. The project needs a `.venv` (`uv sync`) with pytest, plus pytest-cov / hypothesis
22
+ if you switch those policies on. `fixfirst doctor` shows the wiring, the base and the trust status.
23
+
24
+ ## What runs
25
+
26
+ | check | on when (committed config) |
27
+ |---|---|
28
+ | ruff | always; `.ruff.toml` / `ruff.toml` / `[tool.ruff]`, else ruff defaults |
29
+ | bandit | ruff `S` rules selected |
30
+ | ty | `ty.toml` exists |
31
+ | coverage | coverage `fail_under` set; per touched/changed file |
32
+ | Hypothesis evidence | TID251 per-file-ignores in the ruff config (numerical boundary) |
33
+ | tests | `tests/` or a pytest config exists, and the origin matches `FIXFIRST_TRUST` |
34
+ | suppressions | always: any `noqa`, `type/ty/pyright: ignore`, `nosec`, `pragma: no cover`, `fmt: off/skip` … not present at the base |
35
+
36
+ Config is read from git (`HEAD`), never from disk: agent edits to config have no effect and block
37
+ its commit. Only changed files are checked, so old problems in untouched files never block.
38
+
39
+ When: after every agent tool call (changed files, report only), when the agent stops, and on every
40
+ `git commit` through the shim (autofix of changed files, then everything). CI:
41
+ `fixfirst verify --ci origin/<target>`.
42
+
43
+ Limits: stops lazy agents, not hostile ones — root agents, `/usr/bin/git` and sabotage from test
44
+ code are out of scope (ADR-0012). Protect `main` with CI and CODEOWNERS.
45
+
46
+ ## Source and contributions
47
+ Apache-2.0. The source ships in the package on PyPI; development happens in a private repository,
48
+ so there is no public issue tracker and no pull requests.