use brontes::{Config, TaskMode, ToolAnnotations};
const READ_ONLY: &[&str] = &[
"check config",
"check version-files",
"healthcheck",
"jsonschema",
"resolve-tag",
"targets",
"tools",
"vocabulary",
];
const READ_ONLY_NETWORKED: &[&str] = &["preflight"];
const LOCAL_WRITES: &[&str] = &["build", "changelog", "check determinism", "init", "tag"];
const PUBLISHING: &[&str] = &[
"announce", "continue", "notify", "promote", "publish", "release",
];
const LONG_RUNNING: &[&str] = &[
"build",
"check determinism",
"continue",
"promote",
"publish",
"release",
];
pub fn config() -> Config {
let mut cfg = Config::default().tool_name_prefix("anodizer");
cfg = cfg.annotation(
"anodizer",
ToolAnnotations {
read_only_hint: Some(true),
open_world_hint: Some(false),
..Default::default()
},
);
for path in READ_ONLY {
cfg = cfg.annotation(
*path,
ToolAnnotations {
read_only_hint: Some(true),
open_world_hint: Some(false),
..Default::default()
},
);
}
for path in READ_ONLY_NETWORKED {
cfg = cfg.annotation(
*path,
ToolAnnotations {
read_only_hint: Some(true),
open_world_hint: Some(true),
..Default::default()
},
);
}
for path in LOCAL_WRITES {
cfg = cfg.annotation(
*path,
ToolAnnotations {
read_only_hint: Some(false),
destructive_hint: Some(false),
idempotent_hint: Some(true),
open_world_hint: Some(false),
..Default::default()
},
);
}
for path in PUBLISHING {
cfg = cfg.annotation(
*path,
ToolAnnotations {
read_only_hint: Some(false),
destructive_hint: Some(false),
idempotent_hint: Some(true),
open_world_hint: Some(true),
..Default::default()
},
);
}
cfg = cfg.annotation(
"tag rollback",
ToolAnnotations {
read_only_hint: Some(false),
destructive_hint: Some(true),
idempotent_hint: Some(false),
open_world_hint: Some(true),
..Default::default()
},
);
cfg = cfg.annotation(
"bump",
ToolAnnotations {
read_only_hint: Some(false),
destructive_hint: Some(false),
idempotent_hint: Some(false),
open_world_hint: Some(false),
..Default::default()
},
);
for path in LONG_RUNNING {
cfg = cfg.task_mode_for(*path, TaskMode::Detached);
}
cfg = cfg
.description(
"preflight",
"Verify the environment can run the configured release — required tools, \
env vars and secrets (presence only), endpoint reachability, docker, key \
material — and report every failure in one pass. Also prints the \
per-publisher reconcile table. Runs automatically at the start of `release`.",
)
.description(
"release",
"Run the full release pipeline. Re-running the identical command converges \
on already-published state instead of double-publishing, so a re-run is \
how a failed release is recovered.",
);
cfg = cfg.hide_command("completion").hide_command("man");
cfg.group(
"inspect",
READ_ONLY.iter().chain(READ_ONLY_NETWORKED).copied(),
)
.group_description(
"inspect",
"Read-only: validate config, resolve tags, list targets and tools, probe the environment",
)
.group("author", ["init", "changelog", "bump", "tag"])
.group_description(
"author",
"Local edits: scaffold config, refresh the changelog, bump versions, cut tags",
)
.group(
"ship",
PUBLISHING.iter().copied().chain(std::iter::once("build")),
)
.group_description(
"ship",
"Build artifacts and publish them to registries, package managers and chat",
)
}