Skip to main content

harn_cli/package/package_ops/
reports.rs

1use super::*;
2
3#[derive(Debug, Clone, Serialize)]
4pub struct PackageCheckReport {
5    pub package_dir: String,
6    pub manifest_path: String,
7    pub name: Option<String>,
8    pub version: Option<String>,
9    pub errors: Vec<PackageCheckDiagnostic>,
10    pub warnings: Vec<PackageCheckDiagnostic>,
11    pub exports: Vec<PackageExportReport>,
12    pub tools: Vec<PackageToolExportReport>,
13    pub skills: Vec<PackageSkillExportReport>,
14    #[serde(skip_serializing_if = "Vec::is_empty")]
15    pub personas: Vec<PackagePersonaExportReport>,
16}
17
18#[derive(Debug, Clone, Serialize)]
19pub struct PackagePersonaExportReport {
20    pub name: String,
21    pub version: Option<String>,
22    pub entry_workflow: String,
23}
24
25#[derive(Debug, Clone, Serialize)]
26pub struct PackageCheckDiagnostic {
27    pub field: String,
28    pub message: String,
29}
30
31#[derive(Debug, Clone, Serialize)]
32pub struct PackageExportReport {
33    pub name: String,
34    pub path: String,
35    pub symbols: Vec<PackageApiSymbol>,
36}
37
38#[derive(Debug, Clone, Serialize)]
39pub struct PackageToolExportReport {
40    pub name: String,
41    pub module: String,
42    pub symbol: String,
43    pub permissions: Vec<String>,
44    pub host_requirements: Vec<String>,
45}
46
47#[derive(Debug, Clone, Serialize)]
48pub struct PackageSkillExportReport {
49    pub name: String,
50    pub path: String,
51    pub permissions: Vec<String>,
52    pub host_requirements: Vec<String>,
53}
54
55#[derive(Debug, Clone, Serialize)]
56pub struct PackageApiSymbol {
57    pub kind: String,
58    pub name: String,
59    pub signature: String,
60    pub docs: Option<String>,
61}
62
63#[derive(Debug, Clone, Serialize)]
64pub struct PackagePackReport {
65    pub package_dir: String,
66    pub artifact_dir: String,
67    pub dry_run: bool,
68    pub files: Vec<String>,
69    pub check: PackageCheckReport,
70}
71
72#[derive(Debug, Clone, Serialize)]
73pub struct PackagePublishReport {
74    pub dry_run: bool,
75    pub registry: String,
76    pub artifact_dir: String,
77    pub files: Vec<String>,
78    pub tag: String,
79    pub sha: String,
80    pub remote: String,
81    pub index_repo: String,
82    pub index_path: String,
83    #[serde(skip_serializing_if = "Option::is_none")]
84    pub index_pr_url: Option<String>,
85    #[serde(skip_serializing_if = "Option::is_none")]
86    pub tag_command: Option<String>,
87    #[serde(skip_serializing_if = "Option::is_none")]
88    pub index_diff: Option<String>,
89    pub check: PackageCheckReport,
90}
91
92#[derive(Debug, Clone, Serialize)]
93pub struct PackageListReport {
94    pub manifest_path: String,
95    pub lock_path: String,
96    pub lock_present: bool,
97    pub dependency_count: usize,
98    pub packages: Vec<PackageListEntry>,
99    #[serde(skip_serializing_if = "Vec::is_empty")]
100    pub personas: Vec<InstalledPersonaReport>,
101}
102
103#[derive(Debug, Clone, Serialize)]
104pub struct PackageListEntry {
105    pub name: String,
106    pub source: String,
107    pub package_version: Option<String>,
108    pub harn_compat: Option<String>,
109    pub provenance: Option<String>,
110    pub materialized: bool,
111    pub integrity: String,
112    pub exports: PackageLockExports,
113    pub permissions: Vec<String>,
114    pub host_requirements: Vec<String>,
115}
116
117#[derive(Debug, Clone, Serialize)]
118pub struct PackageDoctorReport {
119    pub ok: bool,
120    pub manifest_path: String,
121    pub lock_path: String,
122    pub diagnostics: Vec<PackageDoctorDiagnostic>,
123    pub packages: Vec<PackageListEntry>,
124    #[serde(skip_serializing_if = "Vec::is_empty")]
125    pub personas: Vec<InstalledPersonaReport>,
126}
127
128#[derive(Debug, Clone, Serialize)]
129pub struct InstalledPersonaReport {
130    pub id: String,
131    pub name: String,
132    pub package_alias: String,
133    pub package_version: Option<String>,
134    pub content_hash: Option<String>,
135    pub integrity: String,
136    pub manifest_path: String,
137    pub source: String,
138}
139
140#[derive(Debug, Clone, Serialize)]
141pub struct PackageDoctorDiagnostic {
142    pub severity: String,
143    pub code: String,
144    pub message: String,
145    #[serde(skip_serializing_if = "Option::is_none")]
146    pub help: Option<String>,
147}