red64-cli 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/README.md +64 -58
  2. package/dist/components/screens/StartScreen.d.ts.map +1 -1
  3. package/dist/components/screens/StartScreen.js +2 -2
  4. package/dist/components/screens/StartScreen.js.map +1 -1
  5. package/dist/services/AgentInvoker.js +4 -4
  6. package/dist/services/AgentInvoker.js.map +1 -1
  7. package/dist/services/ClaudeHealthCheck.d.ts +5 -0
  8. package/dist/services/ClaudeHealthCheck.d.ts.map +1 -1
  9. package/dist/services/ClaudeHealthCheck.js +43 -5
  10. package/dist/services/ClaudeHealthCheck.js.map +1 -1
  11. package/dist/services/index.d.ts +1 -1
  12. package/dist/services/index.d.ts.map +1 -1
  13. package/dist/services/index.js +1 -1
  14. package/dist/services/index.js.map +1 -1
  15. package/framework/stacks/c/code-quality.md +326 -0
  16. package/framework/stacks/c/coding-style.md +347 -0
  17. package/framework/stacks/c/conventions.md +513 -0
  18. package/framework/stacks/c/error-handling.md +350 -0
  19. package/framework/stacks/c/feedback.md +158 -0
  20. package/framework/stacks/c/memory-safety.md +408 -0
  21. package/framework/stacks/c/tech.md +122 -0
  22. package/framework/stacks/c/testing.md +472 -0
  23. package/framework/stacks/cpp/code-quality.md +282 -0
  24. package/framework/stacks/cpp/coding-style.md +363 -0
  25. package/framework/stacks/cpp/conventions.md +420 -0
  26. package/framework/stacks/cpp/error-handling.md +264 -0
  27. package/framework/stacks/cpp/feedback.md +104 -0
  28. package/framework/stacks/cpp/memory-safety.md +351 -0
  29. package/framework/stacks/cpp/tech.md +160 -0
  30. package/framework/stacks/cpp/testing.md +323 -0
  31. package/framework/stacks/java/code-quality.md +357 -0
  32. package/framework/stacks/java/coding-style.md +400 -0
  33. package/framework/stacks/java/conventions.md +437 -0
  34. package/framework/stacks/java/error-handling.md +408 -0
  35. package/framework/stacks/java/feedback.md +180 -0
  36. package/framework/stacks/java/tech.md +126 -0
  37. package/framework/stacks/java/testing.md +485 -0
  38. package/framework/stacks/javascript/async-patterns.md +216 -0
  39. package/framework/stacks/javascript/code-quality.md +182 -0
  40. package/framework/stacks/javascript/coding-style.md +293 -0
  41. package/framework/stacks/javascript/conventions.md +268 -0
  42. package/framework/stacks/javascript/error-handling.md +216 -0
  43. package/framework/stacks/javascript/feedback.md +80 -0
  44. package/framework/stacks/javascript/tech.md +114 -0
  45. package/framework/stacks/javascript/testing.md +209 -0
  46. package/framework/stacks/loco/code-quality.md +156 -0
  47. package/framework/stacks/loco/coding-style.md +247 -0
  48. package/framework/stacks/loco/error-handling.md +225 -0
  49. package/framework/stacks/loco/feedback.md +35 -0
  50. package/framework/stacks/loco/loco.md +342 -0
  51. package/framework/stacks/loco/structure.md +193 -0
  52. package/framework/stacks/loco/tech.md +129 -0
  53. package/framework/stacks/loco/testing.md +211 -0
  54. package/framework/stacks/rust/code-quality.md +370 -0
  55. package/framework/stacks/rust/coding-style.md +475 -0
  56. package/framework/stacks/rust/conventions.md +430 -0
  57. package/framework/stacks/rust/error-handling.md +399 -0
  58. package/framework/stacks/rust/feedback.md +152 -0
  59. package/framework/stacks/rust/memory-safety.md +398 -0
  60. package/framework/stacks/rust/tech.md +121 -0
  61. package/framework/stacks/rust/testing.md +528 -0
  62. package/package.json +14 -2
@@ -0,0 +1,370 @@
1
+ # Code Quality Standards
2
+
3
+ Automated code quality tooling for Rust projects: Clippy, rustfmt, cargo-audit, Miri, and CI pipeline configuration.
4
+
5
+ ---
6
+
7
+ ## Philosophy
8
+
9
+ - **Automate everything**: If a tool can catch it, do not rely on humans to catch it
10
+ - **Clippy pedantic by default**: Start strict, selectively allow with justification
11
+ - **Format once, never argue**: `cargo fmt` is non-negotiable
12
+ - **Security is continuous**: Audit dependencies regularly, not just at release
13
+
14
+ ---
15
+
16
+ ## Clippy (Lint Everything)
17
+
18
+ ### Configuration in `Cargo.toml`
19
+
20
+ ```toml
21
+ [lints.clippy]
22
+ # Enable pedantic lint group
23
+ pedantic = { level = "warn", priority = -1 }
24
+
25
+ # Selectively allow specific pedantic lints that are too noisy
26
+ module_name_repetitions = "allow"
27
+ must_use_candidate = "allow"
28
+ missing_errors_doc = "allow"
29
+ missing_panics_doc = "allow"
30
+
31
+ # Deny correctness and suspicious lints
32
+ correctness = { level = "deny", priority = -1 }
33
+ suspicious = { level = "deny", priority = -1 }
34
+
35
+ # Additional useful lints
36
+ nursery = { level = "warn", priority = -1 }
37
+ ```
38
+
39
+ ### Clippy Lint Groups
40
+
41
+ | Group | Level | Purpose |
42
+ |---|---|---|
43
+ | `correctness` | Deny | Likely bugs (e.g., infinite loops, wrong comparisons) |
44
+ | `suspicious` | Deny | Code that is probably wrong |
45
+ | `style` | Warn | Non-idiomatic code |
46
+ | `complexity` | Warn | Unnecessarily complex code |
47
+ | `perf` | Warn | Performance anti-patterns |
48
+ | `pedantic` | Warn | Very strict, opinionated lints |
49
+ | `nursery` | Warn | Experimental but useful lints |
50
+
51
+ ### Running Clippy
52
+
53
+ ```bash
54
+ # Standard check (deny warnings in CI)
55
+ cargo clippy -- -D warnings
56
+
57
+ # Check all targets including tests and benchmarks
58
+ cargo clippy --all-targets --all-features -- -D warnings
59
+
60
+ # Fix auto-fixable lints
61
+ cargo clippy --fix --allow-dirty
62
+
63
+ # Check specific package in workspace
64
+ cargo clippy -p my-crate -- -D warnings
65
+ ```
66
+
67
+ ### Inline Lint Overrides
68
+
69
+ ```rust
70
+ // GOOD: Allow with justification
71
+ #[allow(clippy::cast_possible_truncation)]
72
+ // Truncation is intentional: we only need the lower 32 bits for the hash bucket
73
+ fn bucket_index(hash: u64) -> u32 {
74
+ hash as u32
75
+ }
76
+
77
+ // BAD: Blanket allow without justification
78
+ #[allow(clippy::all)]
79
+ fn some_function() {
80
+ // ...
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Formatting with `rustfmt`
87
+
88
+ ### `rustfmt.toml` Configuration
89
+
90
+ ```toml
91
+ edition = "2024"
92
+ max_width = 100
93
+ tab_spaces = 4
94
+ use_field_init_shorthand = true
95
+ use_try_shorthand = true
96
+ imports_granularity = "Crate"
97
+ group_imports = "StdExternalCrate"
98
+ reorder_imports = true
99
+ ```
100
+
101
+ ### Running Formatter
102
+
103
+ ```bash
104
+ # Format all code
105
+ cargo fmt
106
+
107
+ # Check formatting without modifying (CI)
108
+ cargo fmt -- --check
109
+
110
+ # Format a specific file
111
+ rustfmt src/main.rs
112
+ ```
113
+
114
+ ### Import Organization
115
+
116
+ `rustfmt` with `group_imports = "StdExternalCrate"` enforces:
117
+
118
+ ```rust
119
+ // 1. Standard library
120
+ use std::collections::HashMap;
121
+ use std::sync::Arc;
122
+
123
+ // 2. External crates
124
+ use axum::extract::State;
125
+ use serde::{Deserialize, Serialize};
126
+ use sqlx::PgPool;
127
+
128
+ // 3. Local crate
129
+ use crate::errors::AppError;
130
+ use crate::models::User;
131
+ ```
132
+
133
+ ---
134
+
135
+ ## Security Auditing
136
+
137
+ ### `cargo audit`
138
+
139
+ ```bash
140
+ # Install
141
+ cargo install cargo-audit
142
+
143
+ # Run audit against RustSec advisory database
144
+ cargo audit
145
+
146
+ # Generate JSON report for CI
147
+ cargo audit --json
148
+
149
+ # Fix vulnerable dependencies (interactive)
150
+ cargo audit fix
151
+ ```
152
+
153
+ ### `cargo deny`
154
+
155
+ Comprehensive dependency policy enforcement:
156
+
157
+ ```bash
158
+ # Install
159
+ cargo install cargo-deny
160
+
161
+ # Initialize config
162
+ cargo deny init
163
+ ```
164
+
165
+ ### `deny.toml` Configuration
166
+
167
+ ```toml
168
+ [advisories]
169
+ vulnerability = "deny"
170
+ unmaintained = "warn"
171
+ yanked = "warn"
172
+
173
+ [licenses]
174
+ unlicensed = "deny"
175
+ allow = [
176
+ "MIT",
177
+ "Apache-2.0",
178
+ "BSD-2-Clause",
179
+ "BSD-3-Clause",
180
+ "ISC",
181
+ "Unicode-3.0",
182
+ ]
183
+
184
+ [bans]
185
+ multiple-versions = "warn"
186
+ wildcards = "deny"
187
+
188
+ [sources]
189
+ unknown-registry = "deny"
190
+ unknown-git = "deny"
191
+ allow-registry = ["https://github.com/rust-lang/crates.io-index"]
192
+ ```
193
+
194
+ ```bash
195
+ # Run all checks
196
+ cargo deny check
197
+
198
+ # Run specific check
199
+ cargo deny check advisories
200
+ cargo deny check licenses
201
+ cargo deny check bans
202
+ ```
203
+
204
+ ---
205
+
206
+ ## Miri (Unsafe Code Validation)
207
+
208
+ ### When to Use Miri
209
+
210
+ Use Miri for any crate that contains `unsafe` code:
211
+
212
+ ```bash
213
+ # Install Miri
214
+ rustup +nightly component add miri
215
+
216
+ # Run tests under Miri
217
+ cargo +nightly miri test
218
+
219
+ # Run specific test
220
+ cargo +nightly miri test test_name
221
+
222
+ # Run with stricter checks
223
+ MIRIFLAGS="-Zmiri-strict-provenance" cargo +nightly miri test
224
+ ```
225
+
226
+ ### What Miri Catches
227
+
228
+ | Issue | Example |
229
+ |---|---|
230
+ | Use after free | Accessing deallocated memory |
231
+ | Out-of-bounds access | Buffer overflows |
232
+ | Invalid alignment | Misaligned pointer dereference |
233
+ | Data races | Concurrent unsynchronized access |
234
+ | Uninitialized memory | Reading uninitialized values |
235
+ | Stacked borrows violation | Aliasing rule violations |
236
+
237
+ ```rust
238
+ // Miri will catch this:
239
+ #[test]
240
+ fn test_unsafe_code() {
241
+ let mut data = vec![1, 2, 3];
242
+ let ptr = data.as_ptr();
243
+ data.clear();
244
+ // Miri detects: use after free
245
+ // unsafe { println!("{}", *ptr); }
246
+ }
247
+ ```
248
+
249
+ ---
250
+
251
+ ## Pre-commit Checks
252
+
253
+ ### Git Hook Setup
254
+
255
+ ```bash
256
+ #!/bin/sh
257
+ # .git/hooks/pre-commit
258
+
259
+ set -e
260
+
261
+ echo "Running cargo fmt check..."
262
+ cargo fmt -- --check
263
+
264
+ echo "Running cargo clippy..."
265
+ cargo clippy --all-targets --all-features -- -D warnings
266
+
267
+ echo "Running cargo test..."
268
+ cargo test --quiet
269
+ ```
270
+
271
+ Or use `cargo-husky` for automated hook management:
272
+
273
+ ```toml
274
+ # Cargo.toml
275
+ [dev-dependencies]
276
+ cargo-husky = { version = "1", features = ["precommit-hook", "run-cargo-fmt", "run-cargo-clippy", "run-cargo-test"] }
277
+ ```
278
+
279
+ ---
280
+
281
+ ## CI Pipeline
282
+
283
+ ### Recommended CI Steps
284
+
285
+ ```yaml
286
+ # Example: GitHub Actions
287
+ jobs:
288
+ check:
289
+ runs-on: ubuntu-latest
290
+ steps:
291
+ - uses: actions/checkout@v4
292
+ - uses: dtolnay/rust-toolchain@stable
293
+ with:
294
+ components: rustfmt, clippy
295
+
296
+ # Formatting
297
+ - name: Check formatting
298
+ run: cargo fmt -- --check
299
+
300
+ # Linting
301
+ - name: Clippy
302
+ run: cargo clippy --all-targets --all-features -- -D warnings
303
+
304
+ # Tests
305
+ - name: Run tests
306
+ run: cargo nextest run --all-features
307
+
308
+ # Security audit
309
+ - name: Security audit
310
+ run: cargo audit
311
+
312
+ # Deny check (licenses, advisories, bans)
313
+ - name: Cargo deny
314
+ run: cargo deny check
315
+ ```
316
+
317
+ ### CI Quality Gates
318
+
319
+ | Check | Command | Blocks Merge? |
320
+ |---|---|---|
321
+ | Format | `cargo fmt -- --check` | Yes |
322
+ | Lint | `cargo clippy -- -D warnings` | Yes |
323
+ | Tests | `cargo nextest run` | Yes |
324
+ | Security audit | `cargo audit` | Yes |
325
+ | License check | `cargo deny check licenses` | Yes |
326
+ | Coverage | `cargo llvm-cov --fail-under 80` | Optional |
327
+ | Doc build | `cargo doc --no-deps` | Optional |
328
+
329
+ ---
330
+
331
+ ## Additional Quality Tools
332
+
333
+ ### `cargo-machete` (Unused Dependencies)
334
+
335
+ ```bash
336
+ cargo install cargo-machete
337
+ cargo machete
338
+ ```
339
+
340
+ ### `cargo-bloat` (Binary Size Analysis)
341
+
342
+ ```bash
343
+ cargo install cargo-bloat
344
+ cargo bloat --release
345
+ cargo bloat --release --crates # By crate
346
+ ```
347
+
348
+ ### `cargo-udeps` (Unused Dependencies - Nightly)
349
+
350
+ ```bash
351
+ cargo install cargo-udeps
352
+ cargo +nightly udeps
353
+ ```
354
+
355
+ ---
356
+
357
+ ## Anti-Patterns
358
+
359
+ | Anti-Pattern | Problem | Correct Approach |
360
+ |---|---|---|
361
+ | `#[allow(clippy::all)]` | Disables all safety checks | Allow specific lints with justification |
362
+ | No `cargo fmt` in CI | Style debates in PRs | Enforce formatting in CI pipeline |
363
+ | Ignoring `cargo audit` | Known vulnerabilities in production | Run audit in CI, block on critical advisories |
364
+ | `unsafe` without Miri testing | Memory safety bugs | Test all unsafe code with Miri |
365
+ | Wildcard dependencies (`*`) | Non-reproducible builds | Pin at least major version |
366
+ | Skipping Clippy pedantic | Missing idiomatic patterns | Enable pedantic, allow specific noisy lints |
367
+
368
+ ---
369
+
370
+ _Quality is not a phase; it is a continuous process. Automate checks, fail fast in CI, and treat warnings as errors._