zeph_config/cli.rs
1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Session-scoped CLI configuration: bare mode, JSON output, and auto-approval flags.
5
6use serde::{Deserialize, Serialize};
7
8/// Session-scoped CLI overrides loaded from the `[cli]` TOML section.
9///
10/// Command-line flags take priority over these values. This section has no
11/// effect on Telegram, Discord, Slack, or ACP sessions.
12#[derive(Debug, Clone, Default, Deserialize, Serialize)]
13#[serde(default)]
14#[allow(clippy::struct_excessive_bools)] // config struct — boolean flags are idiomatic for TOML-deserialized configuration
15pub struct CliConfig {
16 /// Enable bare mode (skip skills, memory, MCP, scheduler, watchers).
17 pub bare: bool,
18 /// Enable safe mode (skip ZEPH.md/CLAUDE.md/AGENTS.md, plugins, skills,
19 /// hooks, and MCP servers for this session). Session-scoped only — never
20 /// persisted to `config.toml` (`#[serde(skip)]`), mirroring `--bare`'s
21 /// troubleshooting-flag precedent but gating a disjoint set of subsystems.
22 #[serde(skip)]
23 pub safe_mode: bool,
24 /// Force MCP image passthrough (spec-072) off for this session (`--no-mcp-media`),
25 /// regardless of per-server `media_passthrough` or `[mcp.media]` config. Session-scoped
26 /// only — never persisted to `config.toml` (`#[serde(skip)]`), mirroring `safe_mode`.
27 #[serde(skip)]
28 pub no_mcp_media: bool,
29 /// Emit structured JSON events (JSONL) to stdout. Forces logs to stderr.
30 pub json: bool,
31 /// Auto-approve trust-gate prompts (`-y` / `--auto`).
32 pub auto: bool,
33 /// Loop command configuration.
34 #[serde(rename = "loop")]
35 pub loop_: LoopConfig,
36 /// Tool allowlist for CLI/TUI sessions. `None` means all tools are permitted.
37 #[serde(default)]
38 pub allowed_tools: Option<Vec<String>>,
39}
40
41/// Configuration for the `/loop` command.
42#[derive(Debug, Clone, Deserialize, Serialize)]
43#[serde(default)]
44pub struct LoopConfig {
45 /// Minimum allowed interval between loop ticks (seconds). Floor enforced at parse time.
46 pub min_interval_secs: u64,
47 /// Maximum number of concurrent loops. Reserved for future use; always 1 in v1.
48 pub max_concurrent: u32,
49}
50
51impl Default for LoopConfig {
52 fn default() -> Self {
53 Self {
54 min_interval_secs: 5,
55 max_concurrent: 1,
56 }
57 }
58}