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).
232 lines
7.4 KiB
Rust
232 lines
7.4 KiB
Rust
//! Interactive playground for the Ctrl+T todo pane (hide-done empty state).
|
|
//!
|
|
//! ```text
|
|
//! cargo run -p kigi-tui --bin todo-pane-playground
|
|
//! ```
|
|
//!
|
|
//! Keys: h = hide/show done (same as real pane), n/p = scenario, Esc/q = quit.
|
|
|
|
use std::io::{self, stdout};
|
|
use std::time::Duration;
|
|
|
|
use crossterm::ExecutableCommand;
|
|
use crossterm::event::{self, Event, KeyCode, KeyModifiers};
|
|
use crossterm::terminal::{self, EnterAlternateScreen, LeaveAlternateScreen};
|
|
use kigi_shell::tools::{TodoItem, TodoPriority, TodoStatus};
|
|
use kigi_tui::appearance::LayoutConfig;
|
|
use kigi_tui::views::todo_pane::TodoPane;
|
|
use ratatui::Terminal;
|
|
use ratatui::backend::CrosstermBackend;
|
|
use ratatui::layout::{Constraint, Layout};
|
|
use ratatui::style::{Modifier, Style};
|
|
use ratatui::text::{Line, Span};
|
|
use ratatui::widgets::{Block, Borders, Paragraph, Wrap};
|
|
|
|
type Scenario = (&'static str, &'static str, Vec<TodoItem>);
|
|
|
|
fn item(content: &str, status: TodoStatus) -> TodoItem {
|
|
TodoItem {
|
|
content: content.into(),
|
|
priority: TodoPriority::default(),
|
|
status,
|
|
meta: None,
|
|
}
|
|
}
|
|
|
|
fn scenarios() -> Vec<Scenario> {
|
|
vec![
|
|
(
|
|
"Repro: 5 done + 1 cancelled (press h)",
|
|
"Default show_done=true lists rows; press h → should NOT say All done.",
|
|
vec![
|
|
item("Wire vim mode into command palette", TodoStatus::Completed),
|
|
item("Wire vim mode into /model picker", TodoStatus::Completed),
|
|
item("Wire vim mode into /theme picker", TodoStatus::Completed),
|
|
item("Wire vim mode into /resume picker", TodoStatus::Completed),
|
|
item("Wire vim mode into sessions modal", TodoStatus::Completed),
|
|
item("Ship misleading All done copy", TodoStatus::Cancelled),
|
|
],
|
|
),
|
|
(
|
|
"All completed (press h → All done.)",
|
|
"Hide done with only completed items → All done.",
|
|
vec![
|
|
item("Read Slack feedback", TodoStatus::Completed),
|
|
item("Implement empty_placeholder_message", TodoStatus::Completed),
|
|
item("Add unit tests", TodoStatus::Completed),
|
|
],
|
|
),
|
|
(
|
|
"Only cancelled (press h)",
|
|
"No completed rows → N cancelled., never All done.",
|
|
vec![
|
|
item("Abandoned approach A", TodoStatus::Cancelled),
|
|
item("Abandoned approach B", TodoStatus::Cancelled),
|
|
],
|
|
),
|
|
(
|
|
"Mixed open work",
|
|
"Pending/in progress stay visible when hide done is on.",
|
|
vec![
|
|
item("Done already", TodoStatus::Completed),
|
|
item("In flight", TodoStatus::InProgress),
|
|
item("Not started", TodoStatus::Pending),
|
|
item("Dropped", TodoStatus::Cancelled),
|
|
],
|
|
),
|
|
("Empty plan", "No todos → No todo items.", vec![]),
|
|
]
|
|
}
|
|
|
|
struct App {
|
|
scenarios: Vec<Scenario>,
|
|
active: usize,
|
|
pane: TodoPane,
|
|
layout: LayoutConfig,
|
|
status: String,
|
|
}
|
|
|
|
impl App {
|
|
fn new() -> Self {
|
|
let scenarios = scenarios();
|
|
let mut pane = TodoPane::new();
|
|
pane.overlay.show();
|
|
let mut app = Self {
|
|
scenarios,
|
|
active: 0,
|
|
pane,
|
|
layout: LayoutConfig::default(),
|
|
status: String::new(),
|
|
};
|
|
app.apply_scenario();
|
|
app
|
|
}
|
|
|
|
fn apply_scenario(&mut self) {
|
|
let items = self.scenarios[self.active].2.clone();
|
|
self.pane.update_todos(items);
|
|
// Match real default: done rows visible until user presses h.
|
|
while !self.pane.show_done() {
|
|
self.pane.toggle_show_done();
|
|
}
|
|
self.pane.overlay.show();
|
|
self.refresh_status();
|
|
}
|
|
|
|
fn switch(&mut self, idx: usize) {
|
|
self.active = idx;
|
|
self.apply_scenario();
|
|
}
|
|
|
|
fn refresh_status(&mut self) {
|
|
let c = self.pane.counts();
|
|
let (_, hint, _) = &self.scenarios[self.active];
|
|
self.status = format!(
|
|
"{hint} | counts: ▶{} □{} ✓{} ✗{} show_done={} visible_hint={}",
|
|
c.in_progress,
|
|
c.pending,
|
|
c.completed,
|
|
c.cancelled,
|
|
self.pane.show_done(),
|
|
if self.pane.show_done() {
|
|
"all rows"
|
|
} else {
|
|
"open only (or empty placeholder)"
|
|
},
|
|
);
|
|
}
|
|
}
|
|
|
|
fn main() -> io::Result<()> {
|
|
terminal::enable_raw_mode()?;
|
|
stdout().execute(EnterAlternateScreen)?;
|
|
let mut terminal = Terminal::new(CrosstermBackend::new(stdout()))?;
|
|
let mut app = App::new();
|
|
|
|
loop {
|
|
terminal.draw(|f| draw(f, &mut app))?;
|
|
|
|
if !event::poll(Duration::from_millis(100))? {
|
|
continue;
|
|
}
|
|
let Event::Key(key) = event::read()? else {
|
|
continue;
|
|
};
|
|
if key.kind != event::KeyEventKind::Press {
|
|
continue;
|
|
}
|
|
if matches!(key.code, KeyCode::Esc)
|
|
|| (key.code == KeyCode::Char('q') && key.modifiers == KeyModifiers::NONE)
|
|
|| (key.code == KeyCode::Char('c') && key.modifiers.contains(KeyModifiers::CONTROL))
|
|
{
|
|
break;
|
|
}
|
|
if key.code == KeyCode::Char('n') {
|
|
let next = (app.active + 1) % app.scenarios.len();
|
|
app.switch(next);
|
|
continue;
|
|
}
|
|
if key.code == KeyCode::Char('p') {
|
|
let prev = if app.active == 0 {
|
|
app.scenarios.len() - 1
|
|
} else {
|
|
app.active - 1
|
|
};
|
|
app.switch(prev);
|
|
continue;
|
|
}
|
|
// Forward to TodoPane (h, j/k, /, …) then refresh status for show_done.
|
|
let _ = app.pane.handle_key(&key);
|
|
app.refresh_status();
|
|
}
|
|
|
|
stdout().execute(LeaveAlternateScreen)?;
|
|
terminal::disable_raw_mode()?;
|
|
Ok(())
|
|
}
|
|
|
|
fn draw(f: &mut ratatui::Frame, app: &mut App) {
|
|
let area = f.area();
|
|
let todo_h = app.pane.desired_height(area.height).clamp(3, 12);
|
|
let chunks = Layout::vertical([
|
|
Constraint::Length(4),
|
|
Constraint::Length(todo_h),
|
|
Constraint::Length(4),
|
|
Constraint::Min(0),
|
|
])
|
|
.split(area);
|
|
|
|
let (title, _, _) = &app.scenarios[app.active];
|
|
let header = Paragraph::new(vec![
|
|
Line::from(Span::styled(
|
|
format!(
|
|
"todo-pane-playground [{}/{}] {title}",
|
|
app.active + 1,
|
|
app.scenarios.len(),
|
|
),
|
|
Style::default().add_modifier(Modifier::BOLD),
|
|
)),
|
|
Line::from("h: hide/show done n/p: scenario j/k: navigate list Esc/q: quit"),
|
|
Line::from(
|
|
"Record scenario 1: open → press h → placeholder should show counts, not All done.",
|
|
),
|
|
])
|
|
.block(Block::default().borders(Borders::ALL).title("info"));
|
|
f.render_widget(header, chunks[0]);
|
|
|
|
let todo_area = chunks[1];
|
|
if todo_area.height > 0 && todo_area.width > 0 {
|
|
let block = Block::default()
|
|
.borders(Borders::ALL)
|
|
.title("todo pane (Ctrl+T)");
|
|
let inner = block.inner(todo_area);
|
|
f.render_widget(block, todo_area);
|
|
app.pane.render(inner, f.buffer_mut(), true, &app.layout);
|
|
}
|
|
|
|
let status = Paragraph::new(app.status.clone())
|
|
.wrap(Wrap { trim: false })
|
|
.block(Block::default().borders(Borders::ALL).title("status"));
|
|
f.render_widget(status, chunks[2]);
|
|
}
|