hardgate-linux-arm64 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +176 -0
- package/LICENSE-MIT +21 -0
- package/README.md +292 -0
- package/bin/hardgate +0 -0
- package/package.json +15 -5
- package/bin/.gitkeep +0 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tech Byte Frontier / Tauan BF
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Hardgate
|
|
2
|
+
|
|
3
|
+
**Deterministic quality gates, hard budgets, and anti-gaming verification harness for the AI agent era.**
|
|
4
|
+
|
|
5
|
+
[](https://crates.io/crates/hardgate)
|
|
6
|
+
[](https://docs.rs/hardgate)
|
|
7
|
+
[](https://github.com/Tech-Byte-Frontier/hardgate#license)
|
|
8
|
+
[](#benchmarks)
|
|
9
|
+
[](https://crates.io/crates/hardgate)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="https://raw.githubusercontent.com/Tech-Byte-Frontier/hardgate/main/media/x_article_cover_clean.png" alt="Hardgate Header" width="100%" />
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
## The Problem: Goodhart's Law in the Agent Era
|
|
18
|
+
|
|
19
|
+
In the era of autonomous coding assistants (Claude Code, Cursor, Codex, Devin, Cline, Aider), code generation is essentially free. However, LLM agents are token-efficient cost minimizers operating under **Goodhart’s Law**:
|
|
20
|
+
|
|
21
|
+
> *"When a measure becomes a target, it ceases to be a good measure."*
|
|
22
|
+
|
|
23
|
+
When instructed to *"make the tests pass"* or *"fix the compiler error"*, unconstrained agents optimize for the fastest path to exit code `0`:
|
|
24
|
+
* **Suppression Pragmas:** Quietly slipping `// @ts-ignore`, `/* eslint-disable */`, `#[allow(...)]`, `# noqa`, or `/* c8 ignore */` above signatures instead of fixing underlying types.
|
|
25
|
+
* **Complexity Dumping:** Wrapping complex edge cases in 7-level nested conditionals and 200-line monolithic functions rather than designing clean interfaces.
|
|
26
|
+
* **Vacuous Coverage:** Writing assertion-free tests (`expect(true).toBe(true)`) or mocking everything to artificially hit 100% line coverage with 0% semantic verification.
|
|
27
|
+
* **Boilerplate Duplication:** Copy-pasting 40 lines of code across files because local duplication is cheaper in tokens than discovering and refactoring shared abstractions.
|
|
28
|
+
* **Architectural Leakage:** Bypassing boundaries (e.g. calling native OS APIs or raw database queries directly from UI button components).
|
|
29
|
+
|
|
30
|
+
**You cannot prompt-engineer your way out of software entropy.** Pleading with LLMs through 10-page `.cursorrules` or `CLAUDE.md` files is subjective, non-deterministic, and burns context window tokens on every single turn.
|
|
31
|
+
|
|
32
|
+
**Hardgate** is a single, zero-dependency binary written in Rust that provides machine-enforced deterministic physics that AI agents **physically cannot game**.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Proven in Production: Real-World Benchmarks
|
|
37
|
+
|
|
38
|
+
### 1. Large Fullstack Monorepo (Next.js + Node.js + Shared Packages)
|
|
39
|
+
Dropped cold into an enterprise repository that had never run Hardgate before:
|
|
40
|
+
* **Scanned:** **517 files** and **4,230 functions** using Tree-sitter ASTs.
|
|
41
|
+
* **Execution Time:** **482 milliseconds**.
|
|
42
|
+
* **Findings:** Uncovered **89 duplicate code clones** and **15 hidden suppression pragmas** before traditional linters could even finish parsing config files.
|
|
43
|
+
|
|
44
|
+
### 2. Production Desktop Application (Rust + React/TypeScript)
|
|
45
|
+
Migrated a production desktop app (172 source files, 1,954 functions):
|
|
46
|
+
* **AST Scan Speed:** Evaluated in **165 ms**; incremental `hardgate check --diff` completed in **7 ms**.
|
|
47
|
+
* **Bloat Eliminated:** Replaced 55MB+ of local binaries (`bca`, `jscpd`, `knip`) and erased **~1,000 lines of fragile Node.js glue scripts**.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Comparison: Hardgate vs. Legacy Toolchains
|
|
52
|
+
|
|
53
|
+
| Feature | Legacy Toolchain (ESLint + Knip + jscpd + Stryker) | Hardgate Quality Harness |
|
|
54
|
+
| :--- | :--- | :--- |
|
|
55
|
+
| **Execution Speed** | 30,000ms – 60,000ms | **7ms – 165ms** |
|
|
56
|
+
| **Footprint** | 150MB+ of npm dependencies & Node glue scripts | **Single ~15MB zero-dependency Rust binary** |
|
|
57
|
+
| **Multi-Language AST** | Fragmented per-language runtimes | **Unified Tree-sitter AST: Rust, TS/TSX, JS, Python, Go** |
|
|
58
|
+
| **Anti-Gaming** | Trivially bypassed via `@ts-ignore` / `#[allow(...)]` | **Zero-tolerance suppression detection** |
|
|
59
|
+
| **Clone Detection** | Slow regex/token scrapers (`jscpd`) | **Rabin-Karp token-stream rolling hash** |
|
|
60
|
+
| **Agent Integration** | Unstructured terminal text dumps | **Native MCP server & structured `--format agent` Markdown** |
|
|
61
|
+
| **Mutation Testing** | Heavy, fragile external runners with frequent timeouts | **Native Tree-sitter AST mutator with RAII rollbacks** |
|
|
62
|
+
| **Technical Debt** | Invisible bypasses in config files | **Prominent advisory warnings for excluded paths** |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Core Engines & Capabilities
|
|
67
|
+
|
|
68
|
+
### 1. Hard Physical & AST Complexity Budgets
|
|
69
|
+
Computes Cyclomatic, Cognitive (Sonar model), Halstead difficulty, and ABC (Assignments, Branches, Conditions) metrics per function using Tree-sitter. Enforces strict parameter limits ($\le 4$), nesting depths ($\le 4$), and physical line thresholds.
|
|
70
|
+
|
|
71
|
+
### 2. Zero-Tolerance Anti-Gaming Engine
|
|
72
|
+
Scans ASTs and comment tokens across all languages for compiler, linter, type-checker, and coverage suppression pragmas. Any attempt to silence errors fails the gate immediately.
|
|
73
|
+
|
|
74
|
+
### 3. Native AST Mutation Testing (`hardgate mutate`)
|
|
75
|
+
Validates that test suites actually catch bugs. Automatically targets binary operators (`==`, `!=`, `<`, `>`, `&&`, `||`, `+`, `-`) and boolean literals, executes scoped tests with strict per-mutant timeouts, and guarantees instant disk restoration via RAII `RollbackGuard`.
|
|
76
|
+
|
|
77
|
+
### 4. High-Performance Clone Detection
|
|
78
|
+
Token-stream rolling hash (Rabin-Karp / Winnowing) catching cross-file duplicates ($\ge 5$ lines, $\ge 50$ tokens) before agents merge copy-paste redundancy.
|
|
79
|
+
|
|
80
|
+
### 5. Architectural Invariants
|
|
81
|
+
Declarative boundary enforcement preventing forbidden imports or unauthorized calls between subsystems (e.g., UI $\to$ native IPC or database drivers).
|
|
82
|
+
|
|
83
|
+
### 6. Dead Code & Ghost Module Extermination (`hardgate check --dead-code`)
|
|
84
|
+
Detects orphaned modules and unreferenced exports left behind when agents switch implementation strategies halfway through.
|
|
85
|
+
|
|
86
|
+
### 7. Technical Debt Advisory Notices
|
|
87
|
+
When files are bypassed in `[clones].excludes` or `[budgets.files.exclusions]`, Hardgate emits high-visibility advisory notices during checks:
|
|
88
|
+
```text
|
|
89
|
+
⚠️ Advisory: 25 files excluded from clone detection via hardgate.toml.
|
|
90
|
+
```
|
|
91
|
+
This ensures technical debt remains visible and accounted for over time.
|
|
92
|
+
|
|
93
|
+
### 8. Tool Orchestration (`hardgate fmt` & `hardgate check --all`)
|
|
94
|
+
Automatically detects local `./node_modules/.bin` and global paths, running formatters and linters (`oxfmt`, `cargo fmt`, `oxlint`, `clippy`) in a single unified command.
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Quickstart
|
|
99
|
+
|
|
100
|
+
### Installation
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
# Via npm (recommended for JS/TS projects, no Rust toolchain needed)
|
|
104
|
+
npm i -D hardgate
|
|
105
|
+
npx hardgate check
|
|
106
|
+
|
|
107
|
+
# pnpm / Yarn / Bun (same pattern: devDependency + exec)
|
|
108
|
+
pnpm add -D hardgate
|
|
109
|
+
pnpm exec hardgate check
|
|
110
|
+
|
|
111
|
+
# Via shell (Linux/macOS) / PowerShell (Windows), no npm needed
|
|
112
|
+
curl -fsSL https://raw.githubusercontent.com/Tech-Byte-Frontier/hardgate/main/scripts/install.sh | sh
|
|
113
|
+
irm https://raw.githubusercontent.com/Tech-Byte-Frontier/hardgate/main/scripts/install.ps1 | iex
|
|
114
|
+
|
|
115
|
+
# Via Cargo
|
|
116
|
+
cargo install hardgate
|
|
117
|
+
|
|
118
|
+
# Or clone and build from source
|
|
119
|
+
git clone https://github.com/Tech-Byte-Frontier/hardgate.git
|
|
120
|
+
cd hardgate
|
|
121
|
+
cargo install --path . --locked
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Initialize in Any Repository
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
# Autonomous AI Agent pair-programming preset (default):
|
|
128
|
+
hardgate init --preset strict-agent
|
|
129
|
+
|
|
130
|
+
# Balanced preset for human-AI hybrid teams:
|
|
131
|
+
hardgate init --preset balanced
|
|
132
|
+
|
|
133
|
+
# Migration preset for existing codebases burning down tech debt:
|
|
134
|
+
hardgate init --preset legacy-migration
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Common Commands
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
# Standard check across all source files (<200ms)
|
|
141
|
+
hardgate check
|
|
142
|
+
|
|
143
|
+
# Check only git-modified or staged files (sub-10ms, perfect for pre-commit)
|
|
144
|
+
hardgate check --diff
|
|
145
|
+
|
|
146
|
+
# Full verification: static gates + dead code + orchestration (format + lint)
|
|
147
|
+
hardgate check --all --dead-code
|
|
148
|
+
|
|
149
|
+
# Scoped 1ms AST metric inspection on a single file
|
|
150
|
+
hardgate scan src/services/auth.ts
|
|
151
|
+
|
|
152
|
+
# Format code directly using configured orchestration tools
|
|
153
|
+
hardgate fmt
|
|
154
|
+
|
|
155
|
+
# Run native Tree-sitter AST mutation testing
|
|
156
|
+
hardgate mutate --diff
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## AI Agent Integration (MCP & Claude Code)
|
|
162
|
+
|
|
163
|
+
### Model Context Protocol (MCP) Setup
|
|
164
|
+
Register Hardgate as a native tool server in your assistant's settings (Claude Desktop, Cursor, Windsurf, Cline):
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"mcpServers": {
|
|
169
|
+
"hardgate": {
|
|
170
|
+
"command": "hardgate",
|
|
171
|
+
"args": ["mcp"]
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This exposes three deterministic tools:
|
|
178
|
+
1. `hardgate_check(paths?: string[])`: Runs quality gates on specified files or the entire repository.
|
|
179
|
+
2. `hardgate_scan_file(path: string)`: Inspects complexity and suppressions for a specific file in 1ms.
|
|
180
|
+
3. `hardgate_get_metrics(symbol: string, path: string)`: Returns cyclomatic, cognitive, and line metrics for any function.
|
|
181
|
+
|
|
182
|
+
### Claude Code / Cursor Rule Integration
|
|
183
|
+
|
|
184
|
+
Add to your `CLAUDE.md` or `.cursorrules`:
|
|
185
|
+
```markdown
|
|
186
|
+
Before reporting completion, always verify your edits:
|
|
187
|
+
`hardgate check --diff --format agent`
|
|
188
|
+
|
|
189
|
+
If Hardgate reports violations, refactor immediately. Never insert suppression pragmas.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
When called with `--format agent`, Hardgate delivers structured, pinpoint AST breakdowns directly into the LLM context window:
|
|
193
|
+
|
|
194
|
+
```markdown
|
|
195
|
+
❌ **Hardgate Failed**: 1 violations detected across 1 files.
|
|
196
|
+
|
|
197
|
+
### ⚡ Complexity in `packages/backend/src/lib/match-service.ts:36`
|
|
198
|
+
- Function: `matchCategory`
|
|
199
|
+
- Metric: Cyclomatic Complexity is 11 (Budget limit: 10)
|
|
200
|
+
- Key AST Contributors:
|
|
201
|
+
- Line 40: +1 for conditional branch (`if`)
|
|
202
|
+
- Line 43: +1 for conditional branch (`if`)
|
|
203
|
+
- Line 46: +1 for loop (`for`)
|
|
204
|
+
- Actionable Refactor: Refactor `matchCategory`: extract decision branches into helper functions.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Configuration (`hardgate.toml`)
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
[gate]
|
|
213
|
+
name = "my-service"
|
|
214
|
+
preset = "strict-agent"
|
|
215
|
+
strict = true
|
|
216
|
+
|
|
217
|
+
[budgets.files]
|
|
218
|
+
max_bytes = 32768
|
|
219
|
+
|
|
220
|
+
[budgets.files.max_lines]
|
|
221
|
+
rs = 499
|
|
222
|
+
ts = 400
|
|
223
|
+
tsx = 400
|
|
224
|
+
js = 400
|
|
225
|
+
py = 400
|
|
226
|
+
default = 350
|
|
227
|
+
|
|
228
|
+
# Excluded paths trigger advisory warnings to keep technical debt visible
|
|
229
|
+
[budgets.files.exclusions]
|
|
230
|
+
paths = [
|
|
231
|
+
"src/generated/**"
|
|
232
|
+
]
|
|
233
|
+
|
|
234
|
+
[budgets.functions]
|
|
235
|
+
max_cyclomatic = 10
|
|
236
|
+
max_cognitive = 15
|
|
237
|
+
max_halstead_difficulty = 80.0
|
|
238
|
+
max_parameters = 4
|
|
239
|
+
max_lines = 80
|
|
240
|
+
max_nesting_depth = 4
|
|
241
|
+
|
|
242
|
+
[anti_gaming]
|
|
243
|
+
disallow_suppressions = true
|
|
244
|
+
|
|
245
|
+
[clones]
|
|
246
|
+
enabled = true
|
|
247
|
+
min_lines = 5
|
|
248
|
+
min_tokens = 50
|
|
249
|
+
excludes = [
|
|
250
|
+
"**/tests/**"
|
|
251
|
+
]
|
|
252
|
+
|
|
253
|
+
[mutation]
|
|
254
|
+
enabled = true
|
|
255
|
+
min_score = 85.0
|
|
256
|
+
timeout_secs = 10
|
|
257
|
+
max_mutants = 30
|
|
258
|
+
|
|
259
|
+
[orchestration]
|
|
260
|
+
format_check = "oxfmt --check ."
|
|
261
|
+
format = "oxfmt ."
|
|
262
|
+
lint = "oxlint --type-aware ."
|
|
263
|
+
|
|
264
|
+
[analysis.dead_code]
|
|
265
|
+
enabled = true
|
|
266
|
+
entry_points = [
|
|
267
|
+
"src/main.rs",
|
|
268
|
+
"src/lib.rs",
|
|
269
|
+
"src/index.ts"
|
|
270
|
+
]
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Documentation
|
|
276
|
+
|
|
277
|
+
* [Vision & Paradigm: Harness Engineering](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/docs/VISION_AND_PARADIGM.md)
|
|
278
|
+
* [Configuration Specification (`hardgate.toml`)](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/docs/CONFIGURATION_SPEC.md)
|
|
279
|
+
* [CLI Reference & Agent Integration](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/docs/CLI_AND_INTEGRATION.md)
|
|
280
|
+
* [Existing Landscape & Comparative Analysis](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/docs/EXISTING_LANDSCAPE.md)
|
|
281
|
+
* [System Architecture](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/docs/ARCHITECTURE.md)
|
|
282
|
+
* [API Reference on docs.rs](https://docs.rs/hardgate)
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## License
|
|
287
|
+
|
|
288
|
+
Dual-licensed under either:
|
|
289
|
+
* Apache License, Version 2.0 ([LICENSE-APACHE](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/LICENSE-APACHE))
|
|
290
|
+
* MIT License ([LICENSE-MIT](https://github.com/Tech-Byte-Frontier/hardgate/blob/main/LICENSE-MIT))
|
|
291
|
+
|
|
292
|
+
at your option.
|
package/bin/hardgate
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardgate-linux-arm64",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "hardgate prebuilt binary: linux arm64 (glibc)",
|
|
5
|
-
"license": "MIT OR Apache-2.0",
|
|
5
|
+
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"homepage": "https://github.com/Tech-Byte-Frontier/hardgate",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "https://github.com/Tech-Byte-Frontier/hardgate.git"
|
|
9
|
+
"url": "git+https://github.com/Tech-Byte-Frontier/hardgate.git"
|
|
10
10
|
},
|
|
11
11
|
"os": [
|
|
12
12
|
"linux"
|
|
@@ -18,6 +18,16 @@
|
|
|
18
18
|
"glibc"
|
|
19
19
|
],
|
|
20
20
|
"files": [
|
|
21
|
-
"bin/"
|
|
22
|
-
|
|
21
|
+
"bin/",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE-MIT",
|
|
24
|
+
"LICENSE-APACHE"
|
|
25
|
+
],
|
|
26
|
+
"author": "Tauan BF <contact@techbytefrontier.com>",
|
|
27
|
+
"bugs": "https://github.com/Tech-Byte-Frontier/hardgate/issues",
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public",
|
|
30
|
+
"provenance": true
|
|
31
|
+
},
|
|
32
|
+
"type": "commonjs"
|
|
23
33
|
}
|
package/bin/.gitkeep
DELETED
|
File without changes
|