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:
ZacharyZhang-NY committed 2026-07-23 16:55:39 -04:00
1 parent ff0fb56c67
commit a02b555e66
1458 files changed
+10729 -21750

No files matched your search

+6 -16
View File
@@ -22,9 +22,7 @@ pub use kigi_agent::plugins::discovery::DiscoveryConfig as PluginDiscoveryConfig
pub use kigi_agent::plugins::trust::TrustStore as PluginTrustStore;
pub use kigi_agent::prompt::skills::SkillsConfig;
// ---------------------------------------------------------------------------
// Skill discovery
// ---------------------------------------------------------------------------
/// Discover skills visible from the workspace root.
///
@@ -62,9 +60,7 @@ pub async fn discover_skills(root_cwd: &Path, config: &SkillsConfig) -> Vec<Valu
.collect()
}
// ---------------------------------------------------------------------------
// AGENTS.md discovery
// ---------------------------------------------------------------------------
/// Discover project-instruction files (AGENTS.md, Claude.md, rules) from the workspace root up to the git root.
pub async fn discover_agents_md(root_cwd: &Path) -> Vec<Value> {
@@ -101,9 +97,7 @@ pub async fn discover_agents_md(root_cwd: &Path) -> Vec<Value> {
.collect()
}
// ---------------------------------------------------------------------------
// Plugin discovery
// ---------------------------------------------------------------------------
/// Discover plugins visible from the workspace root.
///
@@ -149,9 +143,7 @@ pub fn discover_plugins(
.collect()
}
// ---------------------------------------------------------------------------
// Project config
// ---------------------------------------------------------------------------
/// Load the project config from `<root_cwd>/.kigi/config.toml`.
///
@@ -199,9 +191,7 @@ fn toml_to_json(v: &toml::Value) -> Value {
}
}
// ---------------------------------------------------------------------------
// Permissions
// ---------------------------------------------------------------------------
/// Load the effective permission configuration for the workspace.
///
@@ -250,7 +240,7 @@ mod tests {
use super::*;
use std::fs;
// ---- Skill discovery tests ----
// Skill discovery tests
// Note: `list_skills` also discovers user-scoped skills from
// `~/.kigi/skills/`, so on a developer machine the result may be
@@ -328,7 +318,7 @@ mod tests {
assert!(found["scope"].is_string(), "scope should be serialized");
}
// ---- AGENTS.md discovery tests ----
// AGENTS.md discovery tests
#[test]
fn agent_config_file_wire_matches_workspace_types_mirror() {
@@ -412,7 +402,7 @@ mod tests {
);
}
// ---- Plugin discovery tests ----
// Plugin discovery tests
// Note: `discover_plugins` also discovers user-scoped plugins
// from `~/.kigi/plugins/`, so tests check for specific plugins.
@@ -472,7 +462,7 @@ mod tests {
assert!(p["has_skills"].is_boolean());
}
// ---- Project config tests ----
// Project config tests
#[test]
fn load_project_config_missing_file_returns_null() {
@@ -505,7 +495,7 @@ mod tests {
);
}
// ---- toml_to_json tests ----
// toml_to_json tests
#[test]
fn toml_to_json_basic_types() {
@@ -532,7 +522,7 @@ mod tests {
assert_eq!(json["items"][2], 3);
}
// ---- Permissions tests ----
// Permissions tests
// Note: `resolve_permissions_with_provenance` checks system-managed
// settings and requirements.toml from the global config, so on a