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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! `greentic-bundle ext …` subcommand (feature-gated).
use std::path::PathBuf;
use clap::{Args, Subcommand};
#[derive(Debug, Args)]
pub struct ExtArgs {
/// Override the install directory (defaults to `state/ext/`).
#[arg(long = "extension-dir", value_name = "DIR", global = true)]
pub extension_dir: Option<PathBuf>,
#[command(subcommand)]
pub command: ExtCommand,
}
#[derive(Debug, Subcommand)]
pub enum ExtCommand {
/// List all discovered extensions and their recipes.
#[command(about = "cli.ext.list.about")]
List,
/// Print metadata for one extension.
#[command(about = "cli.ext.info.about")]
Info {
/// Extension id (e.g. `greentic.bundle-standard`).
extension_id: String,
},
/// Validate a config JSON against a recipe's schema.
#[command(about = "cli.ext.validate.about")]
Validate {
/// Extension id.
extension_id: String,
/// Recipe id.
recipe_id: String,
/// Path to a config JSON file.
#[arg(long, value_name = "FILE")]
config: PathBuf,
},
/// Render a bundle artifact via the ext dispatcher (Mode A only in Phase A).
#[command(about = "cli.ext.render.about")]
Render {
/// Extension id.
extension_id: String,
/// Recipe id.
recipe_id: String,
/// Path to a config JSON file, or `-` to read from stdin.
#[arg(long, value_name = "FILE")]
config: String,
/// Path to a designer session JSON file, or `-` to read from stdin.
#[arg(long, value_name = "FILE")]
session: String,
/// Output file (default: stdout).
#[arg(long, value_name = "FILE")]
out: Option<PathBuf>,
/// Emit a single-line JSON summary on stdout (requires --out) and
/// JSON-formatted errors on non-zero exits. Off by default to preserve
/// the existing human-readable CLI behaviour.
#[arg(long)]
json: bool,
},
/// Print the resolved install directory.
#[command(about = "cli.ext.install_dir.about")]
InstallDir,
}