Skip to main content

kaizen/web/
features.rs

1// SPDX-License-Identifier: AGPL-3.0-or-later
2//! Web feature registry. Every MCP tool maps to a visible product workflow.
3
4mod analysis;
5mod dashboard;
6mod experiments;
7mod session;
8mod settings;
9
10use serde::Serialize;
11
12#[derive(Clone, Copy, Debug, Serialize)]
13pub struct WebFeature {
14    pub route: &'static str,
15    pub section: &'static str,
16    pub label: &'static str,
17    pub tool: &'static str,
18    pub required_args: &'static [&'static str],
19    pub mutating: bool,
20    pub renderer: &'static str,
21    pub empty_state: &'static str,
22    pub error_state: &'static str,
23}
24
25pub fn all() -> Vec<WebFeature> {
26    sections().into_iter().flatten().copied().collect()
27}
28
29pub fn tool_names() -> Vec<&'static str> {
30    all().into_iter().map(|feature| feature.tool).collect()
31}
32
33fn sections() -> [&'static [WebFeature]; 5] {
34    [
35        dashboard::FEATURES,
36        session::FEATURES,
37        analysis::FEATURES,
38        experiments::FEATURES,
39        settings::FEATURES,
40    ]
41}
42
43pub(super) const fn wf(
44    route: &'static str,
45    section: &'static str,
46    label: &'static str,
47    tool: &'static str,
48    required_args: &'static [&'static str],
49    mutating: bool,
50    renderer: &'static str,
51) -> WebFeature {
52    WebFeature {
53        route,
54        section,
55        label,
56        tool,
57        required_args,
58        mutating,
59        renderer,
60        empty_state: "No records yet.",
61        error_state: "Action failed. Open Developer details for the raw response.",
62    }
63}