infra.rs 是 xhyper.rs 项目的基础设施与治理仓库,承载以下职责:
- 可复用的 Rust 基础设施 crate(
kernel/types/testkit) - 统一的工程约定、工具链配置与 CI/CD 流水线
- 多 AI 编码助手(Claude Code / Codex / Copilot)的共享治理配置
# 克隆仓库
git clone https://github.com/xhyperium/infra.rs.git
cd infra.rs
# 构建全部 crate
cargo build --workspace
# 运行测试
cargo test --workspace
# 完整 CI 模拟(格式 + Lint + 测试 + 安全审计)
make cimake build # 编译
make test # 测试
make fmt-check # 格式检查
make lint # Clippy 静态分析
make deny # 依赖安全审计
make ci # 本地完整 CI
make check # 宪章合规性验证在 Cargo.toml 中引用本仓库的 crate(示例):
[dependencies]
xhyper-kernel = { git = "https://github.com/xhyperium/infra.rs.git", package = "kernel" }
xhyper-decimalx = { git = "https://github.com/xhyperium/infra.rs.git", package = "decimalx" }
[dev-dependencies]
xhyper-testkit = { git = "https://github.com/xhyperium/infra.rs.git", package = "testkit" }上述
xhyper-*是依赖键别名;Cargo package 选择器仍分别为kernel、decimalx、testkit。testkit仅允许作为 dev-dependency。
# 健康检查(验证 hooks / skills / beads 就绪)
node scripts/quality-gates/check.mjs
# 初始化 Beads 任务板
bd init && bd prime所有活跃开发须在独立的 Git Worktree 中进行,保持 main 工作区干净。
# 加载快捷命令(建议写入 ~/.bashrc)
eval "$(node scripts/worktree/worktree-activate.mjs)"
# 创建 worktree 并切换
wt feat/my-feature
# 回到 main 工作区
wt main
# 列出所有 worktree
wt
# 管理命令
./scripts/worktree/worktree.mjs create feat/my-feature # 创建
./scripts/worktree/worktree.mjs remove feat/my-feature # 删除
./scripts/worktree/worktree.mjs prune # 清理路径约定:.worktrees/<branch>,分支 / 保留为目录分隔符。
| Crate | 路径 | 说明 |
|---|---|---|
kernel |
crates/kernel/ |
L0 语义信任根(clock / lifecycle) |
testkit |
crates/testkit/ |
ManualClock 等测试支持(仅 dev-dep) |
contract-testkit |
crates/test-support/contracts/ |
Fake + per-trait suite(仅 dev-dep) |
contracts |
crates/contracts/ |
R4 trait 出口(Additive Only) |
xhyper-configx |
crates/infra/configx/ |
L1 配置存储(MemoryConfigStore) |
decimalx |
crates/types/decimal/ |
十进制数值 / Money |
canonical |
crates/types/canonical/ |
跨层共享纯 DTO(Money 复用 decimalx) |
resiliencx |
crates/infra/resiliencx/ |
L1 重试 + 熔断 + 限流 + 舱壁 + retry_async |
xhyper-bootstrap |
crates/infra/bootstrap/ |
L1 唯一组合根(ADR-016 typed composition) |
Rust edition 2024,MSRV 1.85。完整结构见 ARCHITECTURE.md。
| 类别 | 约定 |
|---|---|
| 构建 | .cargo/target/(gitignored),cargo build --workspace |
| 格式 | cargo fmt --all,max_width = 100 |
| Lint | cargo clippy --workspace --all-targets -- -D warnings |
| 测试 | cargo nextest + cargo llvm-cov,覆盖率 >= 80% |
| Beads 测试 | make beads-test(180 assertions,5 套件) |
| 安全 | cargo deny check,禁止 unsafe |
| 提交 | Conventional Commits |
| 分支 | main 受保护,feature 分支 + PR,squash merge |
| 任务 | Beads(bd),本地 Dolt DB |
完整索引与分类规则见 docs/README.md。
| 文档 | 说明 |
|---|---|
| ------ | ------ |
| CONSTITUTION.md | 工程宪章根索引 → docs/constitution/ 分章正文 |
| ARCHITECTURE.md | 架构文档 — 结构、Crate、CI/CD、治理 |
| STATUS.md | 自动生成入库看板:crates 进度/完成度;日常看 docs/status/CRATES_STATUS.local.md(make status) |
| .agents/rules/ | 项目规则 SSOT:版本、worktree、语言、Rust 开发、STE、量化规范 |
| docs/ssot/ | SSOT 对齐矩阵与同步手册 |
| docs/status/ | CI/配置状态与验证记录 |
| docs/decisions/ | 架构决策记录(DDR-001 ~ DDR-009) |
| docs/handoff/ | 交接文档 — bead sync, secrets migration, security baseline (v0.4.0) |
| 系统 | 角色 |
|---|---|
| Claude Code | 主执行:编码、审查、交付 |
| Codex | 编排与派工 |
| Copilot | 补充建议 |
技能 SSOT:.claude/skills/。任务跟踪:bd(make beads-sync-dry / make beads-test 自验证)。
MIT © 2026 xhyperium