Skip to main content

codebridge_cli/
cli.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4#[derive(Parser, Debug)]
5#[command(author, version, about, long_about = None)]
6pub struct Cli {
7    /// Port to listen on
8    #[arg(short, long, default_value_t = 3000)]
9    pub port: u16,
10
11    /// Root directory containing all project workspaces
12    #[arg(short, long, default_value = "../codebridge-workspace")]
13    pub workspace: PathBuf,
14
15    /// Build command to run after actions, or "auto" for automatic detection
16    #[arg(long, default_value = "auto")]
17    pub build_command: String,
18
19    /// Comma‑separated list of allowed shell commands (legacy, kept for compatibility)
20    #[arg(long, value_delimiter = ',', default_value = "npm,cargo,python")]
21    pub allowed_commands: Vec<String>,
22
23    /// Enable script execution (default: false for safety)
24    #[arg(long, default_value_t = false)]
25    pub enable_script_execution: bool,
26
27    /// Comma‑separated list of allowed script languages (deno, python, bash)
28    #[arg(long, value_delimiter = ',', default_value = "deno,python,bash")]
29    pub script_languages: Vec<String>,
30
31    /// Default timeout in seconds for script execution
32    #[arg(long, default_value_t = 30)]
33    pub script_timeout: u64,
34
35    /// Allow scripts to make network requests (dangerous, disabled by default)
36    #[arg(long, default_value_t = false)]
37    pub script_enable_network: bool,
38
39    /// Enable worktree support (default: false)
40    #[arg(long, default_value_t = true)]
41    pub enable_worktrees: bool,
42}