use crate::config::defaults::{
DEFAULT_COMPLEX_FUNCTION_THRESHOLD, DEFAULT_COMPLEXITY_HIGH_THRESHOLD,
DEFAULT_COMPLEXITY_MEDIUM_THRESHOLD, DEFAULT_HUGE_FILE_LINES, DEFAULT_IGNORED_PATHS,
DEFAULT_INSTABILITY_HUB_MIN_FAN_IN, DEFAULT_INSTABILITY_HUB_MIN_INSTABILITY_PCT,
DEFAULT_LONG_FUNCTION_LINES, DEFAULT_MAX_DIRECTORY_DEPTH, DEFAULT_MAX_DIRECTORY_MODULES,
DEFAULT_MAX_FAN_OUT, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_FILE_LINES,
};
pub fn default_config_toml() -> String {
let ignored_paths = DEFAULT_IGNORED_PATHS
.iter()
.map(|path| format!(" \"{path}\""))
.collect::<Vec<_>>()
.join(",\n");
format!(
r#"# RepoPilot configuration file
# Generated by `repopilot init`
[scan]
ignore = [
{ignored_paths}
]
max_file_bytes = {DEFAULT_MAX_FILE_BYTES}
[review]
# Review changed files by default. Use "full" for the pre-0.16 repository-wide view.
scope = "changed"
# Review signals are advisory unless explicitly enabled as a gate.
fail_on = "none"
[architecture]
max_file_lines = {DEFAULT_MAX_FILE_LINES}
huge_file_lines = {DEFAULT_HUGE_FILE_LINES}
max_directory_modules = {DEFAULT_MAX_DIRECTORY_MODULES}
max_directory_depth = {DEFAULT_MAX_DIRECTORY_DEPTH}
max_function_lines = {DEFAULT_LONG_FUNCTION_LINES}
max_fan_out = {DEFAULT_MAX_FAN_OUT}
instability_hub_min_fan_in = {DEFAULT_INSTABILITY_HUB_MIN_FAN_IN}
instability_hub_min_instability_pct = {DEFAULT_INSTABILITY_HUB_MIN_INSTABILITY_PCT}
[code_quality]
complexity_medium_threshold = {DEFAULT_COMPLEXITY_MEDIUM_THRESHOLD}
complexity_high_threshold = {DEFAULT_COMPLEXITY_HIGH_THRESHOLD}
# Per-function cognitive-complexity limit (code-quality.complex-function).
complex_function_threshold = {DEFAULT_COMPLEX_FUNCTION_THRESHOLD}
[testing]
detect_missing_tests = true
[security]
detect_secret_like_names = true
[security_boundary]
# `review` flags when a change touches who-can-do-what or how the app ships
# (auth, CORS, CI/deploy, dependency manifests, committed .env). It flags, it
# does not prove the change is safe. Set enabled = false to silence it.
enabled = true
# Extra glob patterns (repo-relative) to also treat as boundary changes:
# extra_patterns = ["infra/**/*.tf", "**/secrets/**"]
extra_patterns = []
[behavioral]
enabled = true
[algorithmic]
enabled = true
[taint]
# `review` follows request/argv input into SQL, subprocess, filesystem-write,
# and outbound-network sinks within a changed function.
enabled = true
[output]
default_format = "console"
"#
)
}