§9 acceptance: grep-zero sweep — every internal x.ai/grok identifier renamed

The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok'
crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party
license archives, README provenance, and the required 'Based on Grok
Build Open Source' attribution, now sourced from version_attribution.txt).

Wire-visible renames (both sides in this repo, changed in lockstep):
- Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode).
- Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* /
  _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps
  a read-side alias for the legacy '_x.ai/session/update' method so
  existing updates.jsonl histories load; writes emit only the new name
  (both directions test-pinned).
- Agent types grok-build* → kigi* with a documented legacy-prefix alias
  at resolution time so persisted sessions keep resolving.
- ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case
  kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build
  implementation dirs renamed to kigi*.
- x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes
  grokday/groknight → kigiday/kiginight (old persisted values fall back
  to the default theme), web_fetch allowlist xAI hosts → kimi.com +
  moonshot platforms, changelog CDN → this repo, grok-build changelog
  archives deleted.
- BYOK default endpoint removed: [endpoints] api_base_url is now truly
  optional with NO default — consumers fail fast with the flag name when
  unset (no silent x.ai egress). Mock harnesses inject it explicitly.
- System-prompt identity fixed: 'released by xAI' → 'an unofficial
  community CLI for Kimi' (template + regenerated encrypted form).

Also repaired pre-existing grok-era test debt found by the sweep: the
stale trace_classify default-model pin, the grok-pager UA label test,
pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY
test could previously reach the real api.moonshot.cn), and the outdated
oauth fixture scope key.

Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings);
FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed;
deny advisories ok.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-18 02:48:46 -04:00
1 parent 86e3724310
commit 6f31415ed6
1056 files changed
+8410 -18307

No files matched your search

@@ -1,4 +1,4 @@
//! Vendor-compat resolution for `grok inspect`.
//! Vendor-compat resolution for `kigi inspect`.
//!
//! Resolves the local env/config/default stack into a diagnostic report.
+13 -13
View File
@@ -1,6 +1,6 @@
//! `grok inspect` — configuration introspection.
//! `kigi inspect` — configuration introspection.
//!
//! Shows everything Grok discovers in the current directory: project
//! Shows everything Kigi discovers in the current directory: project
//! instructions, permissions, hooks, skills, agents, plugins, MCP servers,
//! LSP config, and config.toml sources. Supports `--json` for machine output.
@@ -249,7 +249,7 @@ pub struct ConfigSources {
pub layers: Vec<ConfigLayer>,
}
/// A single config layer entry for `grok inspect`.
/// A single config layer entry for `kigi inspect`.
#[derive(Debug, Clone, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ConfigLayer {
@@ -503,7 +503,7 @@ async fn list_instructions(cwd: &Path) -> Vec<InstructionFile> {
}
/// Calls the production permission resolver (`resolve_permissions_with_provenance`)
/// which handles both Grok TOML and vendor settings fallback in one codepath.
/// which handles both Kigi TOML and vendor settings fallback in one codepath.
async fn list_permissions(cwd: &Path) -> PermissionsReport {
use kigi_workspace::permission::resolution;
@@ -733,7 +733,7 @@ async fn list_skills(
/// stays non-bundled. Runtime discovery scopes/precedence are untouched.
///
/// `Bundled`/`Server` sources are constructed only here, never by runtime
/// discovery: deployed pagers parse `x.ai/skills/list` into a typed
/// discovery: deployed pagers parse `kigi/skills/list` into a typed
/// `ConfigSource` and reject unknown tags, so runtime stamping must wait
/// until clients without these variants have aged out. Until then this
/// mapping is the single owner of the scope→source translation.
@@ -924,7 +924,7 @@ fn list_lsp_servers(
// Folder-trust gate (display-only): inspect never spawns servers, but mark the
// repo-local (project-scoped) entries a session would skip in an untrusted
// clone so the listing matches the live gate. `remote = None` mirrors
// `grok mcp doctor` (no loaded RemoteSettings in a standalone command).
// `kigi mcp doctor` (no loaded RemoteSettings in a standalone command).
crate::agent::folder_trust::resolve_and_record(cwd, None, false);
let project_allowed = crate::agent::folder_trust::project_scope_allowed(cwd);
@@ -1359,7 +1359,7 @@ fn print_human(r: &InspectReport) {
if r.mcp_servers.is_empty() {
println!();
println!(" MCP Servers (0)");
println!(" {TREE} (none) \u{2014} see `grok mcp add --help`");
println!(" {TREE} (none) \u{2014} see `kigi mcp add --help`");
} else {
print_columns(
"MCP Servers",
@@ -1663,8 +1663,8 @@ mod tests {
fn model_override_warnings_inspect_smoke() {
let effective: toml::Value = toml::from_str(
r#"
[model."grok-4.5"]
model = "grok-4.5"
[model."kigi-4.5"]
model = "kigi-4.5"
env_key = "ANTHROPIC_AUTH_TOKEN"
compactions_remaining = 1
send_compactions_remaining = true
@@ -1686,16 +1686,16 @@ mod tests {
.any(|w| w.field.as_deref() == Some("reasoning_effort")),
"invalid enum should warn: {warnings:?}"
);
assert!(cfg.config_models.contains_key("grok-4.5"));
assert!(cfg.config_models.contains_key("kigi-4.5"));
let human = render_model_override_warnings(&warnings);
assert!(human.contains("Model Overrides"), "{human}");
assert!(
human.contains("[model.\"grok-4.5\"] send_compactions_remaining"),
human.contains("[model.\"kigi-4.5\"] send_compactions_remaining"),
"{human}"
);
assert!(
human.contains("[model.\"grok-4.5\"] reasoning_effort"),
human.contains("[model.\"kigi-4.5\"] reasoning_effort"),
"{human}"
);
assert_eq!(render_model_override_warnings(&[]), "");
@@ -1707,7 +1707,7 @@ mod tests {
.iter()
.find(|w| w["field"] == "send_compactions_remaining")
.expect("alias warning present in JSON");
assert_eq!(alias_warning["modelKey"], "grok-4.5");
assert_eq!(alias_warning["modelKey"], "kigi-4.5");
assert_eq!(alias_warning["kind"], "duplicate-alias");
assert!(
alias_warning["reason"]