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

+5 -7
View File
@@ -477,7 +477,6 @@ fn current_dir_or_exit() -> PathBuf {
})
}
/// Resolve the config file path for a scope.
fn scope_target(scope: McpScope) -> PathBuf {
match scope {
McpScope::User => kigi_shell::util::config::user_config_path(),
@@ -485,7 +484,6 @@ fn scope_target(scope: McpScope) -> PathBuf {
}
}
/// Display form of a scope's config file path.
fn scope_display(scope: McpScope, path: &Path) -> String {
match scope {
McpScope::User => display_user_kigi_path("config.toml"),
@@ -771,7 +769,7 @@ mod tests {
#[test]
fn add_http_transport_with_non_url_command_is_rejected() {
// Previously this silently stored `xcrun` as an HTTP URL.
// Guards against silently storing a non-URL command as an HTTP URL.
let add = parse_add(&[
"kigi",
"mcp",
@@ -789,7 +787,7 @@ mod tests {
#[test]
fn add_explicit_stdio_keeps_url_looking_command_as_stdio() {
// Previously URL sniffing overrode an explicit stdio transport.
// Guards against URL sniffing overriding an explicit stdio transport.
let add = parse_add(&[
"kigi",
"mcp",
@@ -925,8 +923,8 @@ mod tests {
.expect_err("greedy --env must no longer parse");
assert_eq!(err.kind(), clap::error::ErrorKind::ArgumentConflict);
// Without --command the stray pair used to be silently written as the
// command; resolve_add must reject it with migration guidance.
// Without --command, a stray pair must be rejected with migration
// guidance rather than silently written as the command.
let add = parse_add(&[
"kigi", "mcp", "add", "pg", "--env", "A=1", "B=2", "--", "npx", "-y", "server",
]);
@@ -951,7 +949,7 @@ mod tests {
let err = resolve_add(&add).expect_err("--url with stdio transport must fail");
assert!(err.to_string().contains("--url"), "got: {err}");
// --type without --url used to be silently ignored.
// --type without --url must be rejected, not silently ignored.
let add = parse_add(&[
"kigi",
"mcp",