docs(comments): rewrite comments across all crates to the guidelines

Sweep every first-party crate source (1956 .rs files) to the project comment
guidelines: delete redundant restatements, decorative banners, change
narration, and end-of-line comments; keep and tighten the crucial ones
(invariants, bug rationale, SAFETY blocks, ported-source attribution).

No functional code changed. Every edit is proven comment-only against the
prior tree by a comment-stripping lexer (string/char/raw-string aware) plus a
separate doctest-fence check. Where removing a comment made rustfmt or clippy
want to re-lay-out adjacent code, the minimal triggering comment is restored so
code tokens stay byte-identical.

Gates green: cargo fmt --all --check (0 diffs), cargo check and cargo clippy
--workspace --all-targets (0 warnings).

Adds scripts/check_codegen_comment_guidelines.py — the enforcement gate for
these guidelines (flags banners, end-of-line comments, change narration, and
commented-out code).
This commit is contained in:
2026-07-23 16:55:39 -04:00
parent ff0fb56c67
commit a02b555e66
1458 changed files with 10729 additions and 21750 deletions
@@ -26,10 +26,6 @@ use crate::input::key::KeyShortcut;
use crate::views::picker::{PickerConfig, PickerOutcome, PickerState, handle_picker_input};
use crate::views::shortcuts_bar::HintItem;
// ---------------------------------------------------------------------------
// Data
// ---------------------------------------------------------------------------
/// Key for pattern-A inline expand state (`expanded_ids`).
///
/// Registry rows use [`ExpandKey::Action`]; display-only rows that ship
@@ -70,10 +66,6 @@ impl ShortcutsHelpEntry {
}
}
// ---------------------------------------------------------------------------
// Modal state construction
// ---------------------------------------------------------------------------
/// Category display order and labels for the cheatsheet.
const CATEGORY_ORDER: &[(Category, &str)] = &[
(Category::GettingStarted, "Essentials"),
@@ -303,10 +295,6 @@ pub fn build_initial_picker_state(entries: &[ShortcutsHelpEntry]) -> PickerState
}
}
// ---------------------------------------------------------------------------
// Search filtering
// ---------------------------------------------------------------------------
/// Filter ShortcutsHelp entries by search query.
///
/// Returns the original-index list of entries that pass the filter.
@@ -428,10 +416,6 @@ fn hint_description(h: &HintItem) -> String {
})
}
// ---------------------------------------------------------------------------
// Shared helpers
// ---------------------------------------------------------------------------
fn selected_original_entry<'a>(
filtered: &[usize],
entries: &'a [ShortcutsHelpEntry],
@@ -468,10 +452,6 @@ fn picker_config(non_sel: &[bool]) -> PickerConfig<'_> {
}
}
// ---------------------------------------------------------------------------
// Input dispatch
// ---------------------------------------------------------------------------
/// Outcome of an input event delivered to the cheatsheet modal.
///
/// The caller is responsible for mutating `AgentView` state — closing the
@@ -980,10 +960,6 @@ pub fn handle_mouse(
}
}
// ---------------------------------------------------------------------------
// Modal rendering + chrome integration
// ---------------------------------------------------------------------------
/// Footer hints painted along the bottom border of the cheatsheet
/// modal. Identical visual vocabulary for the agent view and the
/// dashboard so muscle memory ports across surfaces.
@@ -1413,10 +1389,6 @@ pub fn handle_modal_key(
}
}
// ---------------------------------------------------------------------------
// Tests
// ---------------------------------------------------------------------------
#[cfg(test)]
mod tests {
use super::*;
@@ -2100,8 +2072,6 @@ mod tests {
assert_eq!(state.selected, 1, "selected should land on first Hint");
}
// ── handle_input tests ───────────────────────────────────────
fn make_key(code: crossterm::event::KeyCode) -> crossterm::event::KeyEvent {
crossterm::event::KeyEvent::new(code, crossterm::event::KeyModifiers::NONE)
}
@@ -2114,7 +2084,7 @@ mod tests {
hint("nav", key!('j')),
];
let mut state = build_initial_picker_state(&entries);
state.selected = 0; // select the header
state.selected = 0;
(entries, state)
}
@@ -2155,7 +2125,7 @@ mod tests {
// Pseudo/legacy hints have no action_id — Enter does not close or open detail.
let entries = vec![header("Nav", 0, 1), hint("send", key!(Enter))];
let mut state = build_initial_picker_state(&entries);
state.selected = 1; // select the hint
state.selected = 1;
let mut mode = browse_mode();
let result = handle_input(
&make_key(crossterm::event::KeyCode::Enter),
@@ -2877,8 +2847,6 @@ mod tests {
assert_eq!(state.query, "j", "printables must type in active search");
}
// ── vim_mode tests ───────────────────────────────────────────
#[test]
fn vim_mode_jk_navigate_without_starting_search() {
let _vim_mode = VimModeGuard::set(true);