Recipe 索引¶
本目录给常见架构需求提供可直接复制执行的最小做法。每个 recipe 按固定九段组织:场景与非场景、架构选择及能力 ID、前置条件与信任边界、最小代码或命令、预期输出与证据、安全/失败负例、可复制验证命令、调用方继续拥有的业务逻辑、升级与回滚注意事项。
选择规则¶
- 需求含领域语义 / 状态机 / 审计 oracle → 留在消费者,不在这里找 Foundation 能力。
- 需要结构或协议校验 → 看
domain-schema-validation。 - 需要安全文件访问或原子写 → 看
safe-filesystem-and-atomic-write。 - 需要确定性人类报告 → 看
deterministic-human-report。 - 需要持久事件与派生快照 → 看
durable-local-state。 - 需要存量采用盘点 → 看
adopt-existing-repository。 - 需要文本资源闭包或宿主接入 → 看
adapter-text-closure/host-profile-integration。 - 需要试用 Quickstart Profile v2 → 精确锁定三个包的 0.3.0 candidate 子路径;需要 v1 时继续锁定 0.2.1。
共同验证约定¶
- 所有示例在新的系统临时目录执行,不留个人路径或凭据。
- 示例不含企业标识、私有 Profile、真实业务数据或个人路径。
- 每个 recipe 至少给出一个正例与一个负例;负例必须产生稳定失败码或拒绝。
- 验证命令可直接复制运行;需要包时先
npm install对应@0.3.0。
能力 ID 总览¶
| Recipe | 首选能力 ID |
|---|---|
| adopt-existing-repository | foundation.kit.adopt-plan |
| safe-filesystem-and-atomic-write | foundation.harness.path-containment、foundation.harness.atomic-write |
| domain-schema-validation | foundation.contracts.object-validation |
| adapter-text-closure | foundation.harness.resource-closure、foundation.harness.host-adapter |
| deterministic-human-report | foundation.harness.report、foundation.kit.report |
| durable-local-state | foundation.harness.state-store |
| host-profile-integration | foundation.kit.host、foundation.profile.extension-spi |