Skip to main content

harn_cli/cli/
pack.rs

1use std::path::PathBuf;
2
3use clap::Args;
4
5#[derive(Debug, Args)]
6#[command(arg_required_else_help = true)]
7pub struct PackArgs {
8    /// Entrypoint `.harn` file to pack. Transitive imports under the
9    /// entrypoint's directory are bundled alongside it.
10    pub entrypoint: PathBuf,
11
12    /// Output `.harnpack` path. Defaults to the entrypoint stem with
13    /// the `.harnpack` extension next to the entrypoint.
14    #[arg(long, value_name = "PATH")]
15    pub out: Option<PathBuf>,
16
17    /// Read an existing `.harnpack` and re-emit it under the v2
18    /// manifest, preserving the prior bundle's id, name, version,
19    /// triggers, workflow graph, and prompt capsules. The new
20    /// `<entrypoint>` argument supplies the transitive-modules /
21    /// SBOM payload that v1 lacked.
22    #[arg(long, value_name = "OLD_BUNDLE")]
23    pub upgrade: Option<PathBuf>,
24
25    /// Sign the bundle hash and embed an Ed25519 signature in the manifest.
26    #[arg(
27        long,
28        default_value_t = false,
29        conflicts_with = "unsigned",
30        requires = "key"
31    )]
32    pub sign: bool,
33
34    /// Ed25519 private key PEM used with `--sign`.
35    #[arg(long, value_name = "PATH", requires = "sign")]
36    pub key: Option<PathBuf>,
37
38    /// Mark the bundle as unsigned. This still emits an OpenTrustGraph
39    /// release record at autonomy tier `suggest`.
40    #[arg(long, default_value_t = false)]
41    pub unsigned: bool,
42
43    /// Emit a `JsonEnvelope` summary instead of a human-readable
44    /// one-liner. Schema: `harn --json-schemas --command pack`.
45    #[arg(long, default_value_t = false)]
46    pub json: bool,
47}