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 /// Emit structured JSON events (JSONL) to stdout. Forces logs to stderr.
25 pub json: bool,
26 /// Auto-approve trust-gate prompts (`-y` / `--auto`).
27 pub auto: bool,
28 /// Loop command configuration.
29 #[serde(rename = "loop")]
30 pub loop_: LoopConfig,
31 /// Tool allowlist for CLI/TUI sessions. `None` means all tools are permitted.
32 #[serde(default)]
33 pub allowed_tools: Option<Vec<String>>,
34}
35
36/// Configuration for the `/loop` command.
37#[derive(Debug, Clone, Deserialize, Serialize)]
38#[serde(default)]
39pub struct LoopConfig {
40 /// Minimum allowed interval between loop ticks (seconds). Floor enforced at parse time.
41 pub min_interval_secs: u64,
42 /// Maximum number of concurrent loops. Reserved for future use; always 1 in v1.
43 pub max_concurrent: u32,
44}
45
46impl Default for LoopConfig {
47 fn default() -> Self {
48 Self {
49 min_interval_secs: 5,
50 max_concurrent: 1,
51 }
52 }
53}