[design] Cargo workspace の crate 分割と feature flag matrix #18
sotashimozono
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Filed by Claude (Anthropic, AI agent operating under souta's GitHub auth) as a gap-fill discussion. Cross-references #14 §3 / #15 §1 / #5 §1 — crate decomposition is referenced but never specified as a normative spec.
Question
doiget の Cargo workspace 構造 (どの crate を作り、 どこに何を置くか、 dependency 方向と feature flag) を Phase 0 で normative spec として lock する。
これは:
doiget-coreの API stability)を統一的に成立させる base layer。
提案する workspace 構造
1. Crate 別の役割と semver
doiget-coredoiget-clidoiget。 CLI parsing + 各 subcommand impldoiget-mcpdoiget-cliのserveから呼ばれるdoiget-obsidiandoiget-coreのpubAPI はdocs/PUBLIC_API.mdで normative に lock (#14 §3 と整合)。 PR で signature 変更があれば必ず ADR + CHANGELOG 反映を要求。2. Dependency 方向
これを CI で enforce:
cargo deny checkまたは手書きtools/check-deps.shでCargo.tomlの deps を検査し、 上記禁止方向を含む PR は fail。3. Feature flag matrix
CI matrix の build 対象 (再掲):
--features oa-only(default test、 必須)--no-default-features(最小 build sanity)--all-features(compile only、 test 不要、 TDM source は wiremock で test 不可)4. crates.io publish 戦略 (#5 §1 と整合)
1 binary + feature flags 路線。 crates.io に publish するのは:
doiget-core(library、 Phase 1 完成後 publish 開始)doiget-cli(binary、 Phase 6 で publish)doiget-mcp(library、 Phase 6 で publish — mcp host integrator が再利用しうる)doiget-obsidian(Phase 7、 publish は任意)published binary は default features =
["oa-only"]のみ。 TDM 込み binary を publish しない (#5 §1 Option 1)。5. Workspace lints / formatting
doiget-mcpcrate は冒頭で:を強制し、 MCP 経路で stdout / stderr を tracing-subscriber 経由のみに制限。
6.
tests/配置workspace 直下の
tests/は integration test 専用。 各 crate 内の#[cfg(test)] mod testsは unit test。7.
examples/の役割Cargo.tomlworkspace member として個別 crate に:CI で
cargo build --examplesを強制し、 README 内 example の link rot を防ぐ (#11 §6)。8. Phase 0 で commit する Cargo.toml の sketch
Open questions
doiget-coreを 0.x 系で永久維持 (semver 0.x の breaking change を minor で許容) する戦略 vs 1.0 を Phase 6 で打つ 戦略。 reviewer 推奨: 0.x 維持 + Phase 6 で 1.0 打つ。 0.x 期間中に Public API を refine、 Phase 6 で freezetests/fixtures/http/をwiremockの record mode で生成するか、 手書きで maintain するか。 reviewer 推奨: 手書き (response shape を明示的に control したい)doiget-obsidianをcrates/配下に置くが workspaceexcludeするか、extras/等別 dir にするか。 reviewer 推奨:crates/配下 +exclude。 Phase 7 着手時に include に変更するだけで済むexamples/の各 example crate を crates.io に publish するか? reviewer 推奨: publish しない (publish = false)。 example は doc / 学習用、 dependency として依存される必要がないDecision proposal
本 Discussion で確定する内容を
docs/ARCHITECTURE.mdの "Workspace structure" 節 + ADRdocs/DECISIONS/0008-crate-decomposition.mdで永続化。doiget-core/doiget-cli/doiget-mcp/doiget-obsidian)oa-onlyのみ、 TDM 込み binary 不公開doiget-corestrict、 他は looseprint_stdoutdeny を Phase 0 からReviewer: Claude (Anthropic). Filed 2026-05-05.
All reactions