M0: compilable skeleton — Kigi 0.1.0 fork surgery

Hard fork of xai-org/grok-build (Apache-2.0) re-targeted as Kigi, an
unofficial Kimi Code CLI community build.

Rename & identity
- 72 xai-*/xai-grok-* crates -> kigi-* (explicit: xai-grok-pager-bin ->
  kigi-bin [binary `kigi`], xai-grok-pager -> kigi-tui; rest mechanical);
  ptyctl, ptyctl-cli, third_party/ unchanged; proto package
  xai.grok.tools.v1 -> kigi.tools.v1
- Config home ~/.kigi (KIGI_SHARE_DIR override), env prefix GROK_* ->
  KIGI_*, `kigi --version` carries the unofficial-community-build notice
- clap identity, help text, startup banner, prompt templates rebranded
  (templates re-encrypted)

Deletions (PRD removal list #5/#6/#7/#9/#10)
- voice input (xai-grok-voice) and all TUI wiring
- telemetry: Mixpanel client, external OTel stream, Sentry, OTLP layers,
  trace/GCS/S3 upload queues (kigi-file-utils halved), workspace upload
  module & dc_log, heap-profile uploader, auth-diagnostics uploader,
  session-analytics halves of feedback; local zero-egress observability
  preserved in new kigi-log crate (unified log, --debug firehose,
  subsystem file logs, opt-in instrumentation)
- announcements (crate, remote-settings fields, TUI surfaces)
- plugin marketplace (crate, sources/browse/CTA/extensions-modal tab);
  direct plugin install/uninstall/update via kigi-agent git_install kept
- relay/gateway/assets endpoints and features (agent relay, headless
  relay transport, gateway bridge, LeaderEnvUrls); leader IPC socket now
  ~/.kigi/leader.sock + KIGI_LEADER_SOCKET, no ws-url derivation
- functional types rehomed instead of deleted: PermissionMode ->
  kigi-config-types, McpInitStrategy -> kigi-mcp, PrCreationSource ->
  session signals, TerminalDiagnostics -> kigi-pager-render, agent_id ->
  shell util

Endpoints
- kigi-env rewritten: single production KigiEndpoints {coding_api_base_url
  https://api.kimi.com/coding/v1 (KIGI_CODE_BASE_URL), oauth_host
  https://auth.kimi.com (KIGI_OAUTH_HOST), update_base_url (GitHub
  Releases API), upgrade_page_url}; GrokBuildEnvironment enum deleted

Toolchain & workspace hygiene
- Rust 1.97.0 pinned; edition 2024; full cargo update; git2 hoisted to
  workspace at 0.21 (Option->Result API migration), quick-xml 0.41
- Root Cargo.toml hand-maintained (PRD §8.1): version 0.1.0 inherited by
  all members, members sorted, unused deps pruned
- cargo-deny advisories gate (deny.toml with documented transitive
  exceptions); CI workflow (check/clippy/fmt/deny/test, macOS+Linux)
- cross-crate test seams re-gated behind `test-support` cargo feature;
  insta snapshot baselines renamed to the kigi_tui prefix
- clippy --workspace --all-targets: zero warnings; fmt clean

Fixes surfaced by the port
- updater probe/installer divergence (bin/kigi vs bin/grok symlink set)
- idle model-metadata refresh dead under KIGI_CODE_BASE_URL override
  (new is_effective_coding_endpoint_url, loopback+override aware)
- macOS symlinked-TMPDIR fixture canonicalization (foreign_sessions,
  fast-worktree); RSS measurement tests serialized via serial_test

Docs & legal (Apache §4)
- NOTICE added (upstream attribution + change statement); THIRD-PARTY
  notices sustained; kigi-tools ported-code notices extended; README,
  CONTRIBUTING, SECURITY, AGENTS.md rewritten

Out of scope for M0 (tracked): Kimi auth/inference (M1), search/fetch,
command parity, config import (M2), Computer Hub excision & final
brand-token sweep (M2), distribution & self-update rewrite (M3).
This commit is contained in:
ZacharyZhang-NY committed 2026-07-17 05:31:01 -04:00
commit d6c20fc13f
2612 files changed
+1353757

No files matched your search

@@ -0,0 +1,149 @@
use ratatui::style::{Color, Modifier};
use super::tokyonight::Theme;
const fn rgb(r: u8, g: u8, b: u8) -> Color {
Color::Rgb(r, g, b)
}
/// Oscura Midnight palette.
///
/// Deep, dark backgrounds with a subtle purple/blue tint (OKLCH hue 265),
/// inspired by the Oscura Midnight palette (narative/oscura). Accent colors
/// lean purple to give the theme its distinctive identity.
///
/// Base colors were converted from OKLCH to sRGB programmatically via
/// the `coloraide` Python library. Purple accent colors are hand-picked
/// to complement the hue-265 background tint.
#[allow(dead_code)]
mod palette {
use super::*;
// -- backgrounds (OKLCH hue 265 backgrounds, OKLCH hue 265) -------
pub const BASE: Color = rgb(3, 3, 4); // #030304 oklch(0.1 0.005 265)
pub const SURFACE: Color = rgb(4, 5, 7); // #040507 oklch(0.115 0.005 265)
pub const ELEVATED: Color = rgb(15, 18, 22); // #0F1216 oklch(0.18 0.01 265)
pub const PANEL: Color = rgb(4, 4, 6); // #040406 oklch(0.11 0.006 265)
// -- text (neutral, no color cast) ----------------------------------------
pub const TEXT: Color = rgb(228, 228, 228); // #E4E4E4 oklch(0.92 0 0)
pub const TEXT_DIM: Color = rgb(190, 190, 190); // #BEBEBE oklch(0.8 0 0)
// -- muted text (slight blue-purple tint) ---------------------------------
pub const MUTED: Color = rgb(129, 134, 143); // #81868F oklch(0.62 0.015 260)
pub const SUBTLE: Color = rgb(94, 100, 108); // #5E646C oklch(0.5 0.015 260)
// -- semantic colors (from desktop action tokens) -------------------------
pub const GOLD: Color = rgb(235, 217, 110); // #EBD96E oklch(0.88 0.13 100)
pub const RED: Color = rgb(220, 90, 100); // #DC5A64 muted rose-red
pub const TEAL: Color = rgb(80, 180, 140); // #50B48C softened teal
pub const AMBER: Color = rgb(241, 189, 0); // #F1BD00 oklch(0.82 0.18 90)
// -- purple accent ramp (the "purple hints") ------------------------------
pub const PURPLE: Color = rgb(155, 126, 206); // #9B7ECE — signature purple
pub const PURPLE_DIM: Color = rgb(110, 90, 154); // #6E5A9A — muted purple
pub const PURPLE_BRIGHT: Color = rgb(196, 167, 231); // #C4A7E7 — vivid lavender
// -- cyan (for running indicators, links) ---------------------------------
pub const CYAN: Color = rgb(125, 207, 223); // #7DCFDF
// -- highlight ramp (purple-tinted grays for UI chrome) -------------------
pub const HIGHLIGHT_LOW: Color = rgb(18, 16, 28); // #12101C
pub const HIGHLIGHT_MED: Color = rgb(36, 32, 52); // #242034
pub const HIGHLIGHT_HIGH: Color = rgb(52, 48, 72); // #343048
}
use palette::*;
impl Theme {
pub const fn oscura_midnight() -> Self {
Self {
bg_base: BASE,
bg_light: ELEVATED,
bg_dark: SURFACE,
bg_highlight: ELEVATED,
bg_hover: HIGHLIGHT_MED,
bg_terminal: BASE,
accent_user: PURPLE_BRIGHT,
accent_assistant: PURPLE,
accent_thinking: MUTED,
accent_tool: SUBTLE,
accent_system: CYAN,
accent_error: RED,
accent_success: TEAL,
accent_running: PURPLE_DIM,
accent_skill: PURPLE,
text_primary: TEXT,
text_secondary: TEXT_DIM,
gray_dim: SUBTLE,
gray: MUTED,
gray_bright: TEXT_DIM,
command: GOLD,
path: AMBER,
running: CYAN,
warning: GOLD,
fuzzy_accent: PURPLE_BRIGHT,
accent_plan: GOLD,
accent_verify: PURPLE,
accent_feedback: TEAL,
accent_remember: rgb(139, 195, 74), // #8BC34A — Material Design light green
selection_border: HIGHLIGHT_HIGH,
hover_border: HIGHLIGHT_MED,
prompt_border: HIGHLIGHT_MED,
prompt_border_active: HIGHLIGHT_HIGH,
accent_model: CYAN,
// Thumb must sit clearly above the track: `ELEVATED` (Σrgb 55)
// was *darker* than the `HIGHLIGHT_LOW` track (Σrgb 62), which
// made the scrollbar invisible — and follow mode blends the
// thumb 40% toward the track, shrinking the delta further.
// `HIGHLIGHT_HIGH` matches the weight of the theme's visible
// chrome (selection border) and Rose Pine's thumb brightness.
scrollbar_bg: HIGHLIGHT_LOW,
scrollbar_fg: HIGHLIGHT_HIGH,
diff_delete_bg: rgb(45, 15, 25),
diff_delete_fg: RED,
diff_insert_bg: rgb(10, 35, 30),
diff_insert_fg: TEAL,
diff_equal_fg: MUTED,
diff_gutter_fg: MUTED,
bg_visual: HIGHLIGHT_MED,
paste_bg: SURFACE,
paste_fg: TEXT_DIM,
paste_dim: MUTED,
md_heading_h1: TEXT,
md_heading_h1_mod: Modifier::BOLD,
md_heading_h2: PURPLE_BRIGHT,
md_heading_h2_mod: Modifier::BOLD,
md_heading_h3: PURPLE,
md_heading_h3_mod: Modifier::BOLD,
md_heading_h4: TEAL,
md_heading_h4_mod: Modifier::BOLD.union(Modifier::ITALIC),
md_heading_h5: GOLD,
md_heading_h5_mod: Modifier::BOLD,
md_heading_h6: CYAN,
md_heading_h6_mod: Modifier::BOLD,
md_code: CYAN,
md_task_checked: TEAL,
md_task_unchecked: TEXT_DIM,
md_muted: MUTED,
md_code_bg: SURFACE,
md_text: TEXT,
link_fg: CYAN,
}
}
}