§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:
1 parent
86e3724310
commit
6f31415ed6
1056 files changed
+8410
-18307
No files matched your search
@@ -221,7 +221,7 @@ pub trait SlashCommand: Send + Sync {
|
||||
}
|
||||
|
||||
/// Whether this command functions in the scrollback-native **minimal**
|
||||
/// mode (`grok --minimal`).
|
||||
/// mode (`kigi --minimal`).
|
||||
///
|
||||
/// Minimal mode deletes the interactive fullscreen scrollback pane, the
|
||||
/// in-app mouse selection/copy path, and the agent dashboard, handing
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `/btw` -- ask a side question without interrupting the running agent.
|
||||
//!
|
||||
//! Returns `CommandResult::Action(Action::SendBtw(...))` so the dispatch layer
|
||||
//! fires it as an ACP ext method (`x.ai/btw`) that bypasses the prompt queue.
|
||||
//! fires it as an ACP ext method (`kigi/btw`) that bypasses the prompt queue.
|
||||
|
||||
use crate::app::actions::Action;
|
||||
use crate::slash::command::{CommandExecCtx, CommandResult, SlashCommand};
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
//! `/docs` -- open How-to Guides (in-TUI) or online Build docs.
|
||||
//! `/docs` -- open How-to Guides (in-TUI) or the online docs.
|
||||
//!
|
||||
//! Bare `/docs` opens the same DocPicker as command-palette "How-to Guides".
|
||||
//! `/docs web` opens https://docs.x.ai/build/overview in the browser.
|
||||
//! `/docs web` opens the Kigi project docs in the browser.
|
||||
//! `/docs <title>` opens a single guide by title (case-insensitive).
|
||||
|
||||
use crate::app::actions::Action;
|
||||
use crate::docs::{all_titles, find_doc};
|
||||
use crate::slash::command::{AppCtx, ArgItem, CommandExecCtx, CommandResult, SlashCommand};
|
||||
|
||||
/// Online Build docs landing page (hardcoded like other TUI deep-links; docs.x.ai can redirect if the path moves).
|
||||
pub const BUILD_DOCS_URL: &str = "https://docs.x.ai/build/overview";
|
||||
/// Online docs landing page (hardcoded like other TUI deep-links; the
|
||||
/// project README is the docs entry point for the GitHub-hosted docs).
|
||||
pub const BUILD_DOCS_URL: &str = "https://github.com/ZacharyZhang-NY/Kigi-CLI#readme";
|
||||
|
||||
/// Open How-to Guides or online Build docs.
|
||||
pub struct DocsCommand;
|
||||
@@ -55,7 +56,7 @@ impl SlashCommand for DocsCommand {
|
||||
display: "web".into(),
|
||||
match_text: "web".into(),
|
||||
insert_text: "web".into(),
|
||||
description: "Open docs.x.ai/build in the browser".into(),
|
||||
description: "Open docs.kigi/build in the browser".into(),
|
||||
},
|
||||
];
|
||||
items.extend(all_titles().map(|title| ArgItem {
|
||||
|
||||
@@ -205,7 +205,7 @@ mod tests {
|
||||
#[test]
|
||||
fn none_and_minimal_rejected_when_model_menu_omits_them() {
|
||||
// Legacy fallback menu is low..xhigh — `none`/`minimal` used to pass
|
||||
// through and 400 on grok-4.5; reject at the TUI instead.
|
||||
// through and 400 on kigi-4.5; reject at the TUI instead.
|
||||
let mut state = ModelState::default();
|
||||
let (id, info) = model_with_reasoning("reasoning-x", "Reasoning X");
|
||||
state.available.insert(id.clone(), info);
|
||||
@@ -292,7 +292,7 @@ mod tests {
|
||||
#[test]
|
||||
fn non_reasoning_model_errors() {
|
||||
let mut state = ModelState::default();
|
||||
let (id, info) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (id, info) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(id.clone(), info);
|
||||
state.current = Some(id);
|
||||
let mut ctx = dummy_exec_ctx(&state);
|
||||
@@ -325,7 +325,7 @@ mod tests {
|
||||
assert!(cmd.suggest_args(&ctx, "").is_none());
|
||||
|
||||
let mut plain = ModelState::default();
|
||||
let (id, info) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (id, info) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
plain.available.insert(id.clone(), info);
|
||||
plain.current = Some(id);
|
||||
let ctx = AppCtx {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//! `/expand` -- re-print the last collapsed block, fully expanded (minimal mode).
|
||||
//!
|
||||
//! In the scrollback-native minimal mode (`grok --minimal`) finalized blocks are
|
||||
//! In the scrollback-native minimal mode (`kigi --minimal`) finalized blocks are
|
||||
//! printed once into the terminal's native scrollback, with reasoning collapsed
|
||||
//! and large tool output truncated (design decision K9). Committed terminal text
|
||||
//! can't be mutated, so "expanding" one is an honest re-print of the same block
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use agent_client_protocol as acp;
|
||||
use kigi_tools::implementations::grok_build::{
|
||||
use kigi_tools::implementations::kigi::{
|
||||
SCHEDULER_CREATE_TOOL_NAME, loop_schedule_instruction, loop_usage_message,
|
||||
};
|
||||
|
||||
|
||||
@@ -140,15 +140,15 @@ mod tests {
|
||||
/// Build a ModelState with two models for testing.
|
||||
fn sample_models() -> ModelState {
|
||||
let mut models = ModelState::default();
|
||||
let id_fast = acp::ModelId::new(Arc::from("grok-4.5"));
|
||||
let id_fast = acp::ModelId::new(Arc::from("kigi-4.5"));
|
||||
models.available.insert(
|
||||
id_fast.clone(),
|
||||
acp::ModelInfo::new(id_fast.clone(), "Grok 4.5".to_string()),
|
||||
acp::ModelInfo::new(id_fast.clone(), "Kigi 4.5".to_string()),
|
||||
);
|
||||
let id_pro = acp::ModelId::new(Arc::from("grok-4.3"));
|
||||
let id_pro = acp::ModelId::new(Arc::from("kigi-4.3"));
|
||||
models.available.insert(
|
||||
id_pro.clone(),
|
||||
acp::ModelInfo::new(id_pro.clone(), "Grok 4.3".to_string()),
|
||||
acp::ModelInfo::new(id_pro.clone(), "Kigi 4.3".to_string()),
|
||||
);
|
||||
models.current = Some(id_fast);
|
||||
models
|
||||
@@ -307,10 +307,10 @@ mod tests {
|
||||
let models = sample_models();
|
||||
let mut ctx = make_ctx(&models);
|
||||
let cmd = model::ModelCommand;
|
||||
let result = cmd.run(&mut ctx, "Grok 4.5");
|
||||
let result = cmd.run(&mut ctx, "Kigi 4.5");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(id)) => {
|
||||
assert_eq!(id.0.as_ref(), "grok-4.5");
|
||||
assert_eq!(id.0.as_ref(), "kigi-4.5");
|
||||
}
|
||||
other => panic!("expected Action(SetDefaultModel), got {other:?}"),
|
||||
}
|
||||
@@ -320,10 +320,10 @@ mod tests {
|
||||
let models = sample_models();
|
||||
let mut ctx = make_ctx(&models);
|
||||
let cmd = model::ModelCommand;
|
||||
let result = cmd.run(&mut ctx, "grok-4.3");
|
||||
let result = cmd.run(&mut ctx, "kigi-4.3");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(id)) => {
|
||||
assert_eq!(id.0.as_ref(), "grok-4.3");
|
||||
assert_eq!(id.0.as_ref(), "kigi-4.3");
|
||||
}
|
||||
other => panic!("expected Action(SetDefaultModel), got {other:?}"),
|
||||
}
|
||||
@@ -333,10 +333,10 @@ mod tests {
|
||||
let models = sample_models();
|
||||
let mut ctx = make_ctx(&models);
|
||||
let cmd = model::ModelCommand;
|
||||
let result = cmd.run(&mut ctx, "grok 4.5");
|
||||
let result = cmd.run(&mut ctx, "kigi 4.5");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(id)) => {
|
||||
assert_eq!(id.0.as_ref(), "grok-4.5");
|
||||
assert_eq!(id.0.as_ref(), "kigi-4.5");
|
||||
}
|
||||
other => panic!("expected Action(SetDefaultModel), got {other:?}"),
|
||||
}
|
||||
@@ -387,12 +387,12 @@ mod tests {
|
||||
assert!(
|
||||
items
|
||||
.iter()
|
||||
.any(|i| i.display.starts_with("Grok 4.5") && i.insert_text == "Grok 4.5")
|
||||
.any(|i| i.display.starts_with("Kigi 4.5") && i.insert_text == "Kigi 4.5")
|
||||
);
|
||||
assert!(
|
||||
items
|
||||
.iter()
|
||||
.any(|i| i.display == "Grok 4.3" && i.insert_text == "Grok 4.3")
|
||||
.any(|i| i.display == "Kigi 4.3" && i.insert_text == "Kigi 4.3")
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
|
||||
@@ -71,8 +71,8 @@ impl SlashCommand for ModelCommand {
|
||||
}
|
||||
|
||||
// Prefer an exact full-string catalog match first. Model display names
|
||||
// often contain spaces ("Grok 4.5"); if we split on the last token
|
||||
// first, a shorter catalog entry ("Grok") would steal the prefix and
|
||||
// often contain spaces ("Kigi 4.5"); if we split on the last token
|
||||
// first, a shorter catalog entry ("Kigi") would steal the prefix and
|
||||
// treat "4.5" as an effort level.
|
||||
if let Some(id) = ctx.models.resolve_by_name_or_id(trimmed) {
|
||||
return CommandResult::Action(Action::SetDefaultModel(id));
|
||||
@@ -80,7 +80,7 @@ impl SlashCommand for ModelCommand {
|
||||
|
||||
// Trailing effort token + reasoning model → session-scoped switch
|
||||
// (not persisted as default). Resolve via the shared gate so a rejected
|
||||
// level (e.g. `none` on grok-4.5) surfaces the effort error with the
|
||||
// level (e.g. `none` on kigi-4.5) surfaces the effort error with the
|
||||
// model's offered ids — not "Unknown model: … none".
|
||||
if let Some((prefix, token)) = split_trailing_token(trimmed)
|
||||
&& let Some(id) = resolve_model(ctx.models, prefix)
|
||||
@@ -267,7 +267,7 @@ mod tests {
|
||||
fn empty_query_returns_one_row_per_logical_model() {
|
||||
let mut state = ModelState::default();
|
||||
let (rid, rinfo) = model_with_reasoning("reasoning-x", "Reasoning X");
|
||||
let (pid, pinfo) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (pid, pinfo) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(rid, rinfo);
|
||||
state.available.insert(pid, pinfo);
|
||||
|
||||
@@ -290,8 +290,8 @@ mod tests {
|
||||
assert_eq!(reasoning.insert_text, "Reasoning X ");
|
||||
|
||||
// Plain model has no trailing space -- Enter commits immediately.
|
||||
let plain = items.iter().find(|i| i.match_text == "Grok 4.5").unwrap();
|
||||
assert_eq!(plain.insert_text, "Grok 4.5");
|
||||
let plain = items.iter().find(|i| i.match_text == "Kigi 4.5").unwrap();
|
||||
assert_eq!(plain.insert_text, "Kigi 4.5");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -408,30 +408,30 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn run_prefers_full_multi_word_model_name_over_prefix_plus_effort() {
|
||||
// Catalog has both "Grok" (reasoning) and "Grok 4.5". `/model Grok 4.5`
|
||||
// must select the full name, not treat "4.5" as an effort on "Grok".
|
||||
// Catalog has both "Kigi" (reasoning) and "Kigi 4.5". `/model Kigi 4.5`
|
||||
// must select the full name, not treat "4.5" as an effort on "Kigi".
|
||||
let mut state = ModelState::default();
|
||||
let (short_id, short_info) = model_with_reasoning("grok", "Grok");
|
||||
let (long_id, long_info) = model_with_reasoning("grok-4.5", "Grok 4.5");
|
||||
let (short_id, short_info) = model_with_reasoning("kigi", "Kigi");
|
||||
let (long_id, long_info) = model_with_reasoning("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(short_id, short_info);
|
||||
state.available.insert(long_id.clone(), long_info);
|
||||
let mut ctx = dummy_exec_ctx(&state);
|
||||
let result = ModelCommand.run(&mut ctx, "Grok 4.5");
|
||||
let result = ModelCommand.run(&mut ctx, "Kigi 4.5");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(resolved_id)) => {
|
||||
assert_eq!(resolved_id, long_id);
|
||||
}
|
||||
other => panic!("expected SetDefaultModel(Grok 4.5), got {other:?}"),
|
||||
other => panic!("expected SetDefaultModel(Kigi 4.5), got {other:?}"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn run_rejects_effort_for_non_reasoning_model() {
|
||||
let mut state = ModelState::default();
|
||||
let (id, info) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (id, info) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(id, info);
|
||||
let mut ctx = dummy_exec_ctx(&state);
|
||||
let result = ModelCommand.run(&mut ctx, "Grok 4.5 high");
|
||||
let result = ModelCommand.run(&mut ctx, "Kigi 4.5 high");
|
||||
// Falls through to "is the whole string a model name?" — which
|
||||
// it isn't, so we get an Unknown error.
|
||||
assert!(matches!(result, CommandResult::Error(_)));
|
||||
@@ -449,10 +449,10 @@ mod tests {
|
||||
#[test]
|
||||
fn run_bare_model_name_dispatches_set_default_model() {
|
||||
let mut state = ModelState::default();
|
||||
let (id, info) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (id, info) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(id.clone(), info);
|
||||
let mut ctx = dummy_exec_ctx(&state);
|
||||
let result = ModelCommand.run(&mut ctx, "Grok 4.5");
|
||||
let result = ModelCommand.run(&mut ctx, "Kigi 4.5");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(resolved_id)) => {
|
||||
assert_eq!(resolved_id, id);
|
||||
@@ -461,15 +461,15 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
/// Case-insensitive matching against the catalog: `/model grok 4.5`
|
||||
/// resolves to the same `ModelId` as `/model Grok 4.5`.
|
||||
/// Case-insensitive matching against the catalog: `/model kigi 4.5`
|
||||
/// resolves to the same `ModelId` as `/model Kigi 4.5`.
|
||||
#[test]
|
||||
fn run_set_default_model_resolves_case_insensitively() {
|
||||
let mut state = ModelState::default();
|
||||
let (id, info) = plain_model("grok-4.5", "Grok 4.5");
|
||||
let (id, info) = plain_model("kigi-4.5", "Kigi 4.5");
|
||||
state.available.insert(id.clone(), info);
|
||||
let mut ctx = dummy_exec_ctx(&state);
|
||||
let result = ModelCommand.run(&mut ctx, "grok 4.5");
|
||||
let result = ModelCommand.run(&mut ctx, "kigi 4.5");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetDefaultModel(resolved_id)) => {
|
||||
assert_eq!(resolved_id, id);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//! `/recap` -- summarize the session so far ("where was I").
|
||||
//!
|
||||
//! Returns `CommandResult::Action(Action::SendRecap { auto: false })` so the
|
||||
//! dispatch layer fires it as an ACP ext method (`x.ai/recap`) that bypasses
|
||||
//! dispatch layer fires it as an ACP ext method (`kigi/recap`) that bypasses
|
||||
//! the prompt queue. The recap arrives asynchronously as a scrollback line and
|
||||
//! is never added to the model conversation.
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ mod tests {
|
||||
theme_cache::seed_auto_theme_defaults_for_test();
|
||||
system_appearance::clear_mock();
|
||||
// Set LOADED=true so current_kind() doesn't try to read from disk.
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
f();
|
||||
system_appearance::clear_mock();
|
||||
theme_cache::reset_for_test();
|
||||
@@ -232,7 +232,7 @@ mod tests {
|
||||
fn suggest_args_explicit_active_when_not_auto() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set_auto_mode(false);
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
let cmd = ThemeCommand;
|
||||
let models = crate::acp::model_state::ModelState::default();
|
||||
let ctx = AppCtx {
|
||||
@@ -241,14 +241,14 @@ mod tests {
|
||||
screen_mode: crate::app::ScreenMode::Fullscreen,
|
||||
};
|
||||
let items = cmd.suggest_args(&ctx, "").expect("should return items");
|
||||
let groknight = items
|
||||
let kiginight = items
|
||||
.iter()
|
||||
.find(|i| i.insert_text == "groknight")
|
||||
.expect("groknight should be in list");
|
||||
.find(|i| i.insert_text == "kiginight")
|
||||
.expect("kiginight should be in list");
|
||||
assert!(
|
||||
groknight.description.contains("(active)"),
|
||||
kiginight.description.contains("(active)"),
|
||||
"explicit theme should show (active), got: {}",
|
||||
groknight.description
|
||||
kiginight.description
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -257,7 +257,7 @@ mod tests {
|
||||
fn suggest_args_no_explicit_active_when_auto() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set_auto_mode(true);
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
let cmd = ThemeCommand;
|
||||
let models = crate::acp::model_state::ModelState::default();
|
||||
let ctx = AppCtx {
|
||||
@@ -298,12 +298,12 @@ mod tests {
|
||||
..crate::settings::PagerLocalSnapshot::default()
|
||||
},
|
||||
};
|
||||
let result = cmd.run(&mut ctx, "groknight");
|
||||
let result = cmd.run(&mut ctx, "kiginight");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetTheme(name)) => {
|
||||
assert_eq!(name, "groknight");
|
||||
assert_eq!(name, "kiginight");
|
||||
}
|
||||
other => panic!("expected Action::SetTheme(\"groknight\"), got {other:?}"),
|
||||
other => panic!("expected Action::SetTheme(\"kiginight\"), got {other:?}"),
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -315,7 +315,7 @@ mod tests {
|
||||
#[test]
|
||||
fn run_toggle_dispatches_set_theme_action() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
// Hard-fail with a clear message if the precondition
|
||||
// breaks — `(0 + 1) % 0` in `run` would otherwise panic
|
||||
// with `attempt to calculate the remainder with a
|
||||
@@ -342,7 +342,7 @@ mod tests {
|
||||
let result = cmd.run(&mut ctx, "");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetTheme(name)) => {
|
||||
// available[0] = GrokNight; next is available[1].
|
||||
// available[0] = KigiNight; next is available[1].
|
||||
let expected = ThemeKind::available()[1].display_name();
|
||||
assert_eq!(name, expected);
|
||||
}
|
||||
@@ -397,13 +397,13 @@ mod tests {
|
||||
..crate::settings::PagerLocalSnapshot::default()
|
||||
},
|
||||
};
|
||||
// "dark" is an alias for GrokNight.
|
||||
// "dark" is an alias for KigiNight.
|
||||
let result = cmd.run(&mut ctx, "dark");
|
||||
match result {
|
||||
CommandResult::Action(Action::SetTheme(name)) => {
|
||||
assert_eq!(name, "groknight", "alias must normalise to canonical");
|
||||
assert_eq!(name, "kiginight", "alias must normalise to canonical");
|
||||
}
|
||||
other => panic!("expected Action::SetTheme(\"groknight\"), got {other:?}"),
|
||||
other => panic!("expected Action::SetTheme(\"kiginight\"), got {other:?}"),
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -416,8 +416,8 @@ mod tests {
|
||||
system_appearance::set_mock(Some(system_appearance::SystemAppearance::Light));
|
||||
let cmd = ThemeCommand;
|
||||
cmd.preview_arg("auto");
|
||||
// Default auto config maps Light -> GrokDay.
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::GrokDay);
|
||||
// Default auto config maps Light -> KigiDay.
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::KigiDay);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -425,10 +425,10 @@ mod tests {
|
||||
#[test]
|
||||
fn preview_explicit_theme_applies_directly() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
let cmd = ThemeCommand;
|
||||
cmd.preview_arg("grokday");
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::GrokDay);
|
||||
cmd.preview_arg("kigiday");
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::KigiDay);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -436,12 +436,12 @@ mod tests {
|
||||
#[test]
|
||||
fn preview_unknown_theme_is_no_op() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
let cmd = ThemeCommand;
|
||||
cmd.preview_arg("nonexistent-theme");
|
||||
assert_eq!(
|
||||
Theme::current_kind(),
|
||||
ThemeKind::GrokNight,
|
||||
ThemeKind::KigiNight,
|
||||
"unknown theme name must NOT change Theme::current_kind",
|
||||
);
|
||||
});
|
||||
@@ -453,17 +453,17 @@ mod tests {
|
||||
#[test]
|
||||
fn cancel_preview_restores_previous_kind() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set(ThemeKind::GrokNight);
|
||||
theme_cache::set(ThemeKind::KigiNight);
|
||||
let cmd = ThemeCommand;
|
||||
// Simulate user navigating into a different theme during preview.
|
||||
cmd.preview_arg("grokday");
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::GrokDay);
|
||||
cmd.preview_arg("kigiday");
|
||||
assert_eq!(Theme::current_kind(), ThemeKind::KigiDay);
|
||||
|
||||
// Then Escape (or arg picker dismissal): restore.
|
||||
cmd.cancel_preview("groknight");
|
||||
cmd.cancel_preview("kiginight");
|
||||
assert_eq!(
|
||||
Theme::current_kind(),
|
||||
ThemeKind::GrokNight,
|
||||
ThemeKind::KigiNight,
|
||||
"cancel_preview must restore the previous canonical",
|
||||
);
|
||||
});
|
||||
@@ -473,12 +473,12 @@ mod tests {
|
||||
#[test]
|
||||
fn cancel_preview_unknown_theme_is_no_op() {
|
||||
with_test_env(|| {
|
||||
theme_cache::set(ThemeKind::GrokDay);
|
||||
theme_cache::set(ThemeKind::KigiDay);
|
||||
let cmd = ThemeCommand;
|
||||
cmd.cancel_preview("nonexistent-theme");
|
||||
assert_eq!(
|
||||
Theme::current_kind(),
|
||||
ThemeKind::GrokDay,
|
||||
ThemeKind::KigiDay,
|
||||
"unknown previous must NOT change Theme::current_kind",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -38,7 +38,7 @@ pub const MAX_VISIBLE_SUGGESTIONS: usize = 6;
|
||||
/// A single row in the slash suggestion dropdown.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct SuggestionRow {
|
||||
/// Display text (e.g., "/model" or "Grok 4 Fast").
|
||||
/// Display text (e.g., "/model" or "Kigi 4 Fast").
|
||||
pub display: String,
|
||||
/// Description text (e.g., "Switch the active model").
|
||||
pub description: String,
|
||||
@@ -1099,7 +1099,7 @@ fn analyze_input(text: &str, cursor: usize) -> Option<SlashInput> {
|
||||
|
||||
/// Parsed slash command invocation.
|
||||
pub struct SlashInvocation<'a> {
|
||||
/// Command token (e.g., "model" for "/model grok-4").
|
||||
/// Command token (e.g., "model" for "/model kigi-4").
|
||||
pub token: &'a str,
|
||||
/// Everything after the command token, trimmed on the left.
|
||||
pub args: &'a str,
|
||||
@@ -1342,9 +1342,9 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn parses_invocation_with_args() {
|
||||
let inv = parse_invocation("/model grok-code-fast-1").expect("parsed");
|
||||
let inv = parse_invocation("/model kigi-code-fast-1").expect("parsed");
|
||||
assert_eq!(inv.token, "model");
|
||||
assert_eq!(inv.args, "grok-code-fast-1");
|
||||
assert_eq!(inv.args, "kigi-code-fast-1");
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1398,7 +1398,7 @@ mod tests {
|
||||
// /model has takes_args=true, args_required=true.
|
||||
assert!(!is_command_complete("/model", ®));
|
||||
assert!(!is_command_complete("/model ", ®));
|
||||
assert!(is_command_complete("/model grok-4", ®));
|
||||
assert!(is_command_complete("/model kigi-4", ®));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1556,8 +1556,8 @@ mod tests {
|
||||
let state = SlashState::default();
|
||||
let models = ModelState::default();
|
||||
|
||||
// Cursor 3 in "/mod grok-4" clamps the query to "mo".
|
||||
ctrl.refresh(&state, "/mod grok-4", 3, &models);
|
||||
// Cursor 3 in "/mod kigi-4" clamps the query to "mo".
|
||||
ctrl.refresh(&state, "/mod kigi-4", 3, &models);
|
||||
let snapshot = state.snapshot();
|
||||
assert!(snapshot.open);
|
||||
assert_eq!(snapshot.query, "mo");
|
||||
@@ -1576,7 +1576,7 @@ mod tests {
|
||||
let state = SlashState::default();
|
||||
let models = ModelState::default();
|
||||
|
||||
ctrl.refresh(&state, "/model grok-4", 3, &models);
|
||||
ctrl.refresh(&state, "/model kigi-4", 3, &models);
|
||||
let snapshot = state.snapshot();
|
||||
assert!(snapshot.open);
|
||||
assert!(snapshot.command_recognized);
|
||||
@@ -2171,7 +2171,7 @@ mod tests {
|
||||
}
|
||||
|
||||
/// Tier-restricted commands stay in the dropdown (discoverability) even
|
||||
/// though `get()` blocks execution — invoking one shows the SuperGrok
|
||||
/// though `get()` blocks execution — invoking one shows the subscription
|
||||
/// upsell (covered by the dispatch-level tests).
|
||||
#[test]
|
||||
fn restricted_commands_stay_visible_in_dropdown() {
|
||||
|
||||
@@ -220,7 +220,7 @@ impl CommandRegistry {
|
||||
///
|
||||
/// Entries are normalized via [`Self::normalize_deny_name`]. Restricted
|
||||
/// commands stay visible in the dropdown/completion (discoverability)
|
||||
/// but disappear from `get()` — invoking one shows the SuperGrok upsell
|
||||
/// but disappear from `get()` — invoking one shows the subscription upsell
|
||||
/// instead of executing (see the `dispatch_send_prompt_inner` hook).
|
||||
/// Pass an empty slice to clear the deny list (e.g. after a tier
|
||||
/// upgrade mid-session).
|
||||
@@ -524,7 +524,7 @@ impl CommandRegistry {
|
||||
// triggers/key entries so the dropdown, ghost completion, and
|
||||
// palette show them like any other command (discoverability).
|
||||
// Execution is blocked by `get()`'s `restricted_match` filter —
|
||||
// invoking one shows the SuperGrok upsell instead.
|
||||
// invoking one shows the subscription upsell instead.
|
||||
|
||||
// Insert canonical key.
|
||||
self.key_to_index.insert(canonical.to_string(), idx);
|
||||
|
||||
Reference in new issue
Block a user