Skip to repository content27 lines · 882 B · rust
tenant.openagents/omega
No repository description is available.
OpenAgents Git authority 2026-07-28T06:56:54.976Z Public web read
NIP-34 coordinate
30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omegaMaintainersHidden in public view
References2 branches · 1 tag
Read-only clone
git clone https://openagents.com/git/tenant.openagents/omega.gitBrowse files
settings.rs
1use std::ops::Range;
2use tree_sitter::{Query, QueryMatch};
3
4use crate::{MigrationPatterns, patterns::SETTINGS_DUPLICATED_AGENT_PATTERN};
5
6pub const SETTINGS_PATTERNS: MigrationPatterns =
7 &[(SETTINGS_DUPLICATED_AGENT_PATTERN, comment_duplicated_agent)];
8
9fn comment_duplicated_agent(
10 contents: &str,
11 mat: &QueryMatch,
12 query: &Query,
13) -> Option<(Range<usize>, String)> {
14 let pair_ix = query.capture_index_for_name("pair1")?;
15 let mut range = mat.nodes_for_capture_index(pair_ix).next()?.byte_range();
16
17 // Include the comma into the commented region
18 let rtext = &contents[range.end..];
19 if let Some(comma_index) = rtext.find(',') {
20 range.end += comma_index + 1;
21 }
22
23 let value = contents[range.clone()].to_string();
24 let commented_value = format!("/* Duplicated key auto-commented: {value} */");
25 Some((range, commented_value))
26}
27