hardgate-darwin-x64 0.4.1 → 0.6.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/README.md +5 -290
- package/bin/.gitkeep +0 -0
- package/bin/hardgate +0 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,292 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# hardgate-darwin-x64
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Native Hardgate binary for `x86_64-apple-darwin`. Installed automatically by
|
|
4
|
+
`@tech-byte-frontier/hardgate`; no Rust toolchain is needed.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
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.
|
|
6
|
+
Static analysis runs locally. Executing project tools requires Linux resource
|
|
7
|
+
containment; read-only child checks additionally require Landlock.
|
package/bin/.gitkeep
ADDED
|
File without changes
|
package/bin/hardgate
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hardgate-darwin-x64",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "hardgate prebuilt binary:
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "hardgate prebuilt binary: darwin x64",
|
|
5
5
|
"license": "(MIT OR Apache-2.0)",
|
|
6
6
|
"homepage": "https://github.com/Tech-Byte-Frontier/hardgate",
|
|
7
7
|
"repository": {
|