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:
@@ -14,7 +14,6 @@ use crate::appearance::permission_cursor::DefaultSelectedPermission;
|
||||
use kigi_shell::agent::config::UiConfig;
|
||||
use kigi_tools::implementations::kigi::ask_user_question;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Int bounds for `max_thoughts_width`.
|
||||
//
|
||||
// Stored as `u16` in `UiConfig`, exposed as `i64` for registry uniformity.
|
||||
@@ -28,14 +27,12 @@ pub(crate) const MAX_THOUGHTS_WIDTH_MAX: i64 = 500;
|
||||
/// definition and the live-wrap-preview gate in the int stepper.
|
||||
pub(crate) const MAX_THOUGHTS_WIDTH_KEY: &str = "max_thoughts_width";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Theme choice catalogs.
|
||||
//
|
||||
// Canonical names MUST match `ThemeKind::display_name()`.
|
||||
// Shared by `theme`, `auto_dark_theme`, and `auto_light_theme`;
|
||||
// auto-* sub-pickers drop "auto" to avoid circular reference.
|
||||
// Bounded by `MAX_PICKER_CHOICES`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Full theme catalog including the "auto" meta-variant. Used by `theme` only.
|
||||
const THEME_CHOICES: &[EnumChoice] = &[
|
||||
@@ -72,7 +69,6 @@ const THEME_CHOICES: &[EnumChoice] = &[
|
||||
},
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Permission-mode catalog.
|
||||
//
|
||||
// Persisted values map onto runtime flags:
|
||||
@@ -89,7 +85,6 @@ const THEME_CHOICES: &[EnumChoice] = &[
|
||||
// (2) `EnumChoice` here, (3) `set_yolo_mode_inner` update,
|
||||
// (4) `load_permission_mode` arm, (5) tests. `Plan` is excluded —
|
||||
// it lives on its own `plan_mode` setting.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// Choice order: safe → classifier → unsafe (Default → Ask → Auto → Always approve).
|
||||
// "Always approve" at the end creates a speed bump against
|
||||
@@ -119,21 +114,6 @@ const PERMISSION_MODE_CHOICES: &[EnumChoice] = &[
|
||||
},
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Plan-mode catalog.
|
||||
//
|
||||
// PAGER-owned, per-session, ACP-mediated via `session/set_mode`.
|
||||
// NOT persisted to config.toml — resets every session start.
|
||||
//
|
||||
// Uses `on`/`off` canonical strings (not the shell's `plan`/`default`
|
||||
// wire ids). `Ask` mode is intentionally not exposed here — it's
|
||||
// only reachable via Shift+Tab.
|
||||
//
|
||||
// `supports_preview: false` — toggling fires an ACP request that
|
||||
// gates tool dispatch. Commit on Enter only.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Default-selected-permission catalog.
|
||||
//
|
||||
// Persisted to `[ui].default_selected_permission` in config.toml. Controls
|
||||
@@ -147,8 +127,7 @@ const PERMISSION_MODE_CHOICES: &[EnumChoice] = &[
|
||||
//
|
||||
// `supports_preview: false` — permission prompts aren't open in the modal
|
||||
// background, so there's no live preview surface.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Order matches the live permission prompt rendering (YOLO -> always-allow
|
||||
// -> allow-once -> reject) so the picker mirrors what the user sees on the
|
||||
// real prompt.
|
||||
@@ -178,6 +157,17 @@ const DEFAULT_SELECTED_PERMISSION_CHOICES: &[EnumChoice] = &[
|
||||
},
|
||||
];
|
||||
|
||||
// Plan-mode catalog.
|
||||
//
|
||||
// PAGER-owned, per-session, ACP-mediated via `session/set_mode`.
|
||||
// NOT persisted to config.toml — resets every session start.
|
||||
//
|
||||
// Uses `on`/`off` canonical strings (not the shell's `plan`/`default`
|
||||
// wire ids). `Ask` mode is intentionally not exposed here — it's
|
||||
// only reachable via Shift+Tab.
|
||||
//
|
||||
// `supports_preview: false` — toggling fires an ACP request that
|
||||
// gates tool dispatch. Commit on Enter only.
|
||||
const PLAN_MODE_CHOICES: &[EnumChoice] = &[
|
||||
EnumChoice {
|
||||
canonical: "off",
|
||||
@@ -191,13 +181,11 @@ const PLAN_MODE_CHOICES: &[EnumChoice] = &[
|
||||
},
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Mermaid-rendering catalog.
|
||||
//
|
||||
// SHELL-owned: persisted to `[ui].render_mermaid`, with a pager-side
|
||||
// process-wide cache mirror (`appearance::cache::*_render_mermaid`) for the
|
||||
// render hot path. Canonicals match `RenderMermaid::as_canonical`.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const RENDER_MERMAID_CHOICES: &[EnumChoice] = &[
|
||||
EnumChoice {
|
||||
@@ -468,7 +456,6 @@ pub fn default_settings() -> Vec<SettingMeta> {
|
||||
restart_required: false,
|
||||
hidden_in_minimal: false,
|
||||
},
|
||||
// --- theme + auto themes ---------------------------------------------
|
||||
SettingMeta {
|
||||
key: "theme",
|
||||
category: SettingCategory::Appearance,
|
||||
@@ -1204,7 +1191,7 @@ pub fn default_settings() -> Vec<SettingMeta> {
|
||||
restart_required: false,
|
||||
hidden_in_minimal: false,
|
||||
},
|
||||
// ── TodoGate (runtime turn-end backstop) ──────────────────────
|
||||
// TodoGate (runtime turn-end backstop):
|
||||
//
|
||||
// Only the CLI flag (`--todo-gate`) is wired. Settings-modal
|
||||
// entries for `[reminder.todo_gate]` are deferred — the modal
|
||||
|
||||
@@ -6,10 +6,6 @@ use agent_client_protocol as acp;
|
||||
use kigi_shell::agent::config::UiConfig;
|
||||
use kigi_tools::implementations::kigi::ask_user_question;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Stable identity for a setting. The string id matches the `UiConfig`
|
||||
/// serde field name (for SHELL/SHARED settings) and is the canonical key
|
||||
/// referenced by tests, telemetry, and registry lookups.
|
||||
@@ -338,10 +334,6 @@ impl PagerLocalSnapshot {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Registry
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Process-wide settings registry. Built in `main` and stored on
|
||||
/// `AppView::settings_registry: Arc<SettingsRegistry>`.
|
||||
#[derive(Debug, Clone)]
|
||||
@@ -371,7 +363,6 @@ impl SettingsRegistry {
|
||||
&self.entries
|
||||
}
|
||||
|
||||
/// Look up a setting by key.
|
||||
pub fn find(&self, key: SettingKey) -> Option<&SettingMeta> {
|
||||
self.entries.iter().find(|m| m.key == key)
|
||||
}
|
||||
@@ -433,10 +424,6 @@ fn build_search_haystack(m: &SettingMeta) -> String {
|
||||
s
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Snapshot reads — the one place that maps SettingKey → live field.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Read the current value of `key` from `UiConfig` (SHELL/SHARED) or
|
||||
/// pager snapshot (PAGER-owned). Returns `None` for unknown keys.
|
||||
/// Adding a new Bool setting requires arms here, in `action_for_bool`,
|
||||
@@ -630,10 +617,6 @@ pub fn default_value_for(meta: &SettingMeta) -> SettingValue {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -795,7 +778,6 @@ mod tests {
|
||||
cfg.models.default at session start",
|
||||
);
|
||||
}
|
||||
// max_thoughts_width: `u16` widened to `i64`.
|
||||
("max_thoughts_width", SettingKind::Int { default, .. }) => {
|
||||
assert_eq!(
|
||||
*default, ui.max_thoughts_width as i64,
|
||||
@@ -814,7 +796,6 @@ mod tests {
|
||||
(matches auto_update.rs's `.unwrap_or(true)`)"
|
||||
);
|
||||
}
|
||||
// vim_mode: Option<bool>; None → false.
|
||||
("vim_mode", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -822,7 +803,6 @@ mod tests {
|
||||
"vim_mode default drifts from UiConfig::default()"
|
||||
);
|
||||
}
|
||||
// remember_tool_approvals: Option<bool>; None → false.
|
||||
("remember_tool_approvals", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -840,7 +820,6 @@ mod tests {
|
||||
shared resolver const in kigi-tools"
|
||||
);
|
||||
}
|
||||
// show_thinking_blocks: Option<bool>; None → true (client default).
|
||||
("show_thinking_blocks", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -848,7 +827,6 @@ mod tests {
|
||||
"show_thinking_blocks default drifts from UiConfig::default()"
|
||||
);
|
||||
}
|
||||
// group_tool_verbs: Option<bool>; None → true (client default).
|
||||
("group_tool_verbs", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -866,7 +844,6 @@ mod tests {
|
||||
);
|
||||
assert!(!*default, "collapsed_edit_blocks must default OFF");
|
||||
}
|
||||
// prompt_suggestions: Option<bool>; None → true (client default).
|
||||
("prompt_suggestions", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -882,7 +859,6 @@ mod tests {
|
||||
};
|
||||
assert_eq!(*default, expected);
|
||||
}
|
||||
// hunk_tracker_mode: Option<String>; None → "agent_only".
|
||||
("hunk_tracker_mode", SettingKind::Enum { default, .. }) => {
|
||||
assert_eq!(
|
||||
ui.hunk_tracker_mode, None,
|
||||
@@ -906,7 +882,6 @@ mod tests {
|
||||
);
|
||||
assert_eq!(*default, "fullscreen");
|
||||
}
|
||||
// render_mermaid: Option<String>; None → "auto".
|
||||
("render_mermaid", SettingKind::Enum { default, .. }) => {
|
||||
assert_eq!(
|
||||
ui.render_mermaid, None,
|
||||
@@ -923,7 +898,6 @@ mod tests {
|
||||
"render_mermaid default drifts from UiConfig::default()",
|
||||
);
|
||||
}
|
||||
// scroll_speed: Option<u8>; None → 50.
|
||||
("scroll_speed", SettingKind::Int { default, .. }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -943,7 +917,6 @@ mod tests {
|
||||
"scroll_mode default drifts from UiConfig::default()",
|
||||
);
|
||||
}
|
||||
// invert_scroll: Option<bool>; None → false.
|
||||
("invert_scroll", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
@@ -951,7 +924,6 @@ mod tests {
|
||||
"invert_scroll default drifts from UiConfig::default()"
|
||||
);
|
||||
}
|
||||
// display_refresh.auto_cadence_enabled: Option<bool>; None → false.
|
||||
("display_refresh_auto_cadence", SettingKind::Bool { default }) => {
|
||||
assert_eq!(
|
||||
*default,
|
||||
|
||||
Reference in New Issue
Block a user