1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! `tm project` (singular, local-registry) command group.
//!
//! Why: extracted from `cli.rs` (issue #2603) to keep the top-level file
//! under the 500-SLOC production cap. Distinct from the plural
//! `tm projects` registry-B surface in `actions::projects`.
//! What: [`ProjectAction`] — `init`/`list`/`info`/`trust`.
//! Test: exercised via `cli::Command::Project` parse coverage in `tests.rs`.
use clap::Subcommand;
/// Actions for the `project` subcommand.
#[derive(Debug, Subcommand)]
pub(crate) enum ProjectAction {
/// Register a working directory as a trusty-mpm project.
Init {
/// Directory to register (defaults to the cwd).
#[arg(long)]
dir: Option<String>,
},
/// List all registered projects with their status.
List,
/// Show the current project's registered info and config.
Info {
/// Project directory (defaults to the cwd).
#[arg(long)]
dir: Option<String>,
},
/// Grant (or revoke) consent for a project's `[mcp.custom]` manifest
/// entries to be bridged into fleet sessions (issue #3033 security fix).
///
/// A project-scope `[mcp.custom]` entry ships with the cloned repo
/// itself, so `session_launch::custom_mcp` refuses to honor it until the
/// operator explicitly runs this command. Trust is recorded in USER-scope
/// state under `~/.trusty-tools/trusty-mpm/project-trust.json` — never
/// inside the repo — so a cloned repo can never self-trust.
///
/// IMPORTANT: trust is PER-DIRECTORY (a canonicalized path), not
/// per-repo-content. Replacing what's checked out at an already-trusted
/// path (re-cloning a different repo into the same path, or checking out
/// an attacker-controlled branch/remote in place) silently inherits the
/// existing grant. If you replace a trusted directory's contents,
/// `--revoke` first and re-trust afterward — or clone to a new path,
/// which starts untrusted by default.
Trust {
/// Project directory to trust or revoke (defaults to the cwd).
#[arg(long)]
dir: Option<String>,
/// Revoke trust instead of granting it.
#[arg(long)]
revoke: bool,
},
}