Files
Kigi-CLI/crates/codegen/kigi-shell/src/lib.rs
T
ZacharyZhang-NY 913caed6d3 F7: one-time read-only import of the official kimi-cli configuration
New `kigi import-kimi` (with --dry-run) plus a one-time welcome-screen
hint when ~/.kimi/config.toml is present and unimported.

- Sources: ~/.kimi/config.toml (default_model, [models.*], [providers.*])
  and ~/.kimi/mcp.json ({"mcpServers": ...} — parsed by the existing
  McpConfig machinery). Shapes ported from kimi-cli 1.49.0 config.py with
  citations.
- Strictly read-only over ~/.kimi: plain reads only; the test suite pins
  byte-identical contents AND unchanged mtimes across scan+apply. Keyring
  credentials are never imported; KIMI_SHARE_DIR / any KIMI_* env var is
  never consulted (official dir hardcoded to ~/.kimi).
- Mapping: MCP servers merge into kigi [mcp_servers.*] without clobbering
  existing names; models on non-built-in providers become kigi [model.*]
  custom entries (base_url + api_key + context_window); providers that
  duplicate kigi's built-in Kimi/Moonshot platforms are skipped with a
  note; default_model maps to the imported alias or the managed catalog
  key and never overwrites an existing default.
- One-time marker ~/.kigi/kimi_import_done (claude-import convention);
  the startup hint and re-runs no-op once set. api_key values flow only
  into the user's own config.toml and are redacted in every summary.

Verified end-to-end with the real binary in a sandboxed home: dry-run,
apply, `kigi mcp list` shows both imported servers, second run no-ops,
~/.kimi mtimes unchanged. 8 unit tests + CLI parse test.
2026-07-17 20:50:45 -04:00

40 lines
856 B
Rust

#![allow(
unused_imports,
unused_variables,
unused_mut,
unreachable_code,
dead_code
)]
pub(crate) use kigi_log::unified_log;
pub use kigi_tracing_macros::{teprintln, timed, tprintln};
pub mod active_sessions;
pub mod agent;
pub mod auth;
pub mod builtin;
pub mod bundle;
pub mod claude_import;
pub mod claude_import_state;
pub mod cli_models;
pub mod config;
pub use kigi_shell_base::cpu_profile;
pub use kigi_shell_base::env;
pub mod extensions;
pub use kigi_http as http;
pub use kigi_workspace::foreign_sessions;
pub mod inspect;
pub mod instrumentation;
pub mod kimi_import;
pub mod leader;
pub mod managed_config;
pub mod mcp_doctor;
pub use kigi_models as models;
pub mod plugin;
pub mod sampling;
pub mod session;
pub mod terminal;
#[cfg(test)]
pub(crate) mod test_support;
pub mod tools;
pub mod trace_classifier;
pub mod util;