Files
Kigi-CLI/crates/codegen/kigi-shell/src/auth/config.rs
T
ZacharyZhang-NY a02b555e66 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).
2026-07-23 16:55:39 -04:00

41 lines
1.3 KiB
Rust

//! Kimi Code auth configuration.
//!
//! The wire endpoints come from [`kigi_env`] (`oauth_host()`, overridable via
//! `KIGI_OAUTH_HOST`) and the client id is fixed
//! ([`crate::auth::kimi_oauth::KIMI_CODE_CLIENT_ID`]), so this config carries
//! no per-deployment OAuth knobs. The struct is kept (deserialized from the
//! agent config TOML) as the extension point for future auth options.
use serde::{Deserialize, Serialize};
/// Persisted-credential scope key for the Kimi Code OAuth session — both the
/// auth.json map key and the system-keyring entry name (service `kigi`).
pub const KIMI_CODE_OAUTH_SCOPE: &str = "oauth/kimi-code";
/// Auth configuration block (`[kimi_code_config]` in the agent config).
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(default)]
pub struct KimiCodeConfig {}
impl KimiCodeConfig {
pub fn auth_scope(&self) -> String {
KIMI_CODE_OAUTH_SCOPE.to_owned()
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn auth_scope_is_the_kimi_code_key() {
assert_eq!(KimiCodeConfig::default().auth_scope(), "oauth/kimi-code");
}
#[test]
fn deserializes_from_empty_toml() {
let cfg: KimiCodeConfig = toml::from_str("").expect("empty config parses");
assert_eq!(cfg.auth_scope(), KIMI_CODE_OAUTH_SCOPE);
}
}