Skip to content

Commit 9e95bcf

Browse files
committed
fix: honor managed settings drop-in scope
1 parent 0ba8cb3 commit 9e95bcf

1 file changed

Lines changed: 14 additions & 13 deletions

File tree

crates/agnix-core/src/rules/claude_settings.rs

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,8 +1976,8 @@ fn validate_auto_mode_in_settings_local(
19761976
/// user-level settings (`~/.claude/settings.json`), `--settings` files, and
19771977
/// managed settings are honored. Repo-resident `.claude/settings.json` and
19781978
/// `.claude/settings.local.json` no longer supply `pluginConfigs`; the key
1979-
/// is silently ignored there. `managed-settings.json` IS honored, so it is
1980-
/// skipped.
1979+
/// is silently ignored there. Managed settings files are honored, so they
1980+
/// are skipped.
19811981
///
19821982
/// Fires on any non-null value; `null` is treated as field-absent,
19831983
/// consistent with the CC-SET family. Note agnix lints repo checkouts —
@@ -1990,12 +1990,7 @@ fn validate_plugin_configs_scope(
19901990
value: &serde_json::Value,
19911991
diagnostics: &mut Vec<Diagnostic>,
19921992
) {
1993-
let is_managed = path
1994-
.file_name()
1995-
.and_then(|n| n.to_str())
1996-
.map(|n| n == "managed-settings.json")
1997-
.unwrap_or(false);
1998-
if is_managed {
1993+
if is_claude_managed_settings_path(path) {
19991994
return;
20001995
}
20011996

@@ -2266,11 +2261,9 @@ fn validate_remote_control_at_startup_scope(
22662261
value: &serde_json::Value,
22672262
diagnostics: &mut Vec<Diagnostic>,
22682263
) {
2269-
let is_managed = path
2270-
.file_name()
2271-
.and_then(|name| name.to_str())
2272-
.is_some_and(|name| name == "managed-settings.json");
2273-
if is_managed || value.get("remoteControlAtStartup") != Some(&serde_json::Value::Bool(true)) {
2264+
if is_claude_managed_settings_path(path)
2265+
|| value.get("remoteControlAtStartup") != Some(&serde_json::Value::Bool(true))
2266+
{
22742267
return;
22752268
}
22762269

@@ -2498,6 +2491,8 @@ mod tests {
24982491
let content = r#"{
24992492
"crossSessionInbound": "prompt",
25002493
"dialogExpiry": "30s",
2494+
"pluginConfigs": {"my-plugin": {}},
2495+
"remoteControlAtStartup": true,
25012496
"sandbox": {
25022497
"network": {"tlsTerminate": {}},
25032498
"credentials": {
@@ -2536,6 +2531,12 @@ mod tests {
25362531
.find(|diagnostic| diagnostic.rule == "CC-SET-012")
25372532
.is_some_and(|diagnostic| diagnostic.message.contains("reuses"))
25382533
);
2534+
for rule in ["CC-SET-015", "CC-SET-021"] {
2535+
assert!(
2536+
diagnostics.iter().all(|diagnostic| diagnostic.rule != rule),
2537+
"unexpected project-scope {rule} for managed settings path {path}"
2538+
);
2539+
}
25392540
}
25402541
}
25412542

0 commit comments

Comments
 (0)