KeiSeiKit-1.0/_blocks/stack-rust-cli.md
denis 0b901cf2f9 feat: KeiSeiKit v0.1.0 — initial public release
Generic Constructor-Pattern agent kit for Claude Code. Zero personal data,
fully English, MIT-licensed.

Contents:
- 34 reusable blocks (baseline, rules, stack/deploy/domain/api/scraper)
- 14 cross-project agent manifests (code/ml/infra/researcher/critic/...)
- 6 portable skills (/new-agent, /research, /test-gen, /debug-deep, /pr-review, /refactor)
- Rust assembler (single binary, ~500 KB)
- 3 hooks (auto-reassemble, pre-commit validate, no-hand-edit)
- install.sh (idempotent, cargo-builds on first run)
- MIT LICENSE

All 6 sanity greps pass: 0 Russian text, 0 specific project names,
0 incident numbers, 0 user paths, 0 hardcoded IPs, 0 API keys.

cargo check + assemble --validate: both pass on 14 manifests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 23:58:34 +08:00

24 lines
1.2 KiB
Markdown

# STACK — Rust CLI / tooling
Cargo workspace. Default language — no language justification needed.
**Layout:**
- Workspace root `Cargo.toml` declares `members = [...]`; one crate per cube.
- Binaries under `<crate>/src/bin/*.rs`; library root `<crate>/src/lib.rs`.
- Integration tests in `<crate>/tests/*.rs`; unit tests inline with `#[cfg(test)]`.
**Hard invariants:**
- File > 200 LOC → split (Constructor Pattern). Function > 30 LOC → split.
- `clippy::pedantic` in CI; warnings = errors on `main`.
- `thiserror` for library error enums, `anyhow::Result` for binaries only. Never `Box<dyn Error>` in new code.
- NO `.unwrap()` / `.expect()` in prod paths. Allowed in tests and one-shot scripts flagged `// SCRIPT`.
- Benchmarks live under `benches/` with `cargo bench` (Criterion) and the documented number is ALWAYS from `cargo test --release` / `cargo bench` — never debug timings.
**CI gate:**
```
cargo fmt --check && cargo clippy --all-targets -- -D warnings && cargo test --release
```
**Pre-commit:** `cargo fmt && cargo clippy --fix --allow-dirty && cargo test`.
**Forbidden:** `Rc<RefCell<...>>` in hot paths (use `&mut` or `Arc<Mutex<_>>`); `unsafe` without a `// SAFETY:` comment explaining the invariant; panic-on-parse in library crates.