git-ents.gitmain
⌘K
foforge
package.rs33 lines · 1.3 KB · rusthistorycomment on this file
1//! The convention `git ents` mounts a package's subcommand through
2//! (`docs/abstractions.adoc`, "CLI dispatch seam"): each package owns its
3//! own figue action enum, defined in its own crate — never here — and
4//! `crate::cli::Top` references that type directly as a variant's field.
5//! This trait exists to pin that pairing at compile time, not to
6//! register anything at runtime: figue resolves `Top`'s subcommand
7//! grammar from its `#[derive(Facet)]` shape alone, so there is no
8//! dynamic mounting step to generalize (`git-ents-engineering`: no
9//! abstraction beyond what forge and kiln concretely require).
10//! Kernel-owned commands (`setup`, `members`, `account`, `effect`,
11//! `inbox`, `redact`, `hook`) are not packages under this trait:
12//! `git-ents` is their composition root directly, with no package
13//! boundary to pin.
14
15/// A `git ents` package mounted into the CLI's subcommand surface: it
16/// owns one top-level subcommand's figue action enum, defined in its own
17/// crate.
18pub trait Package {
19 /// This package's subcommand action enum.
20 type Action;
21}
22
23/// The forge package: owns `git ents comment`.
24pub struct Forge;
25impl Package for Forge {
26 type Action = ents_forge::comment::CommentAction;
27}
28
29/// The kiln package: owns `git ents toolchain`.
30pub struct Kiln;
31impl Package for Kiln {
32 type Action = ents_kiln::toolchain::ToolchainAction;
33}