use std::process::ExitCode;
use serde::Serialize;
use crate::output::CommandReport;
const DEPRECATION_NOTE: &str =
"`ccd pod` is retired (RFC 0006 pod-layer collapse). See the replacement \
surface below.";
#[derive(Serialize)]
pub struct PodShimReport {
command: &'static str,
ok: bool,
deprecated: bool,
message: &'static str,
replacement: &'static str,
}
impl CommandReport for PodShimReport {
fn exit_code(&self) -> ExitCode {
if self.ok {
ExitCode::SUCCESS
} else {
ExitCode::FAILURE
}
}
fn render_text(&self) {
eprintln!("warning: {}", self.message);
eprintln!("hint: {}", self.replacement);
}
}
pub fn list_shim() -> PodShimReport {
PodShimReport {
command: "pod-list",
ok: false,
deprecated: true,
message: DEPRECATION_NOTE,
replacement: "`ccd pod list` is retired; run `ccd machine list` for the post-collapse \
inventory. The two commands have different report shapes, so this shim \
fails closed rather than silently returning a different schema.",
}
}
pub fn status_shim() -> PodShimReport {
PodShimReport {
command: "pod-status",
ok: false,
deprecated: true,
message: DEPRECATION_NOTE,
replacement: "run `ccd status --path .` for coordination-scope visibility, or \
`ccd doctor --path .` for the full health report.",
}
}
pub fn init_shim() -> PodShimReport {
PodShimReport {
command: "pod-init",
ok: false,
deprecated: true,
message: DEPRECATION_NOTE,
replacement: "`ccd pod init` is retired; coordination scopes are no longer \
authored via CLI. Set `[dispatch].coordination_scope` in the \
repo overlay config directly if you need to wire a profile into \
a shared scope.",
}
}
pub fn migrate_defaults_shim() -> PodShimReport {
PodShimReport {
command: "pod-migrate-defaults",
ok: false,
deprecated: true,
message: DEPRECATION_NOTE,
replacement: "`ccd pod migrate-defaults` is retired under RFC 0006 with no automated \
replacement. Review `~/.ccd/profiles/<p>/memory.md` and \
`~/.ccd/profiles/<p>/policy.md` by hand and split entries into \
repo-local overlays where appropriate. Note: `ccd migrate from-pod-layout` \
is a separate tool (machine-identity/presence layout migration) and does \
NOT migrate profile defaults.",
}
}