All Rust code must be formatted using cargo fmt before submission:
# Format all code
cargo fmt
# Check formatting without modifying files
cargo fmt --checkInstall the pre-commit hook to automatically check formatting:
# Install pre-commit (if not already installed)
pip install pre-commit
# Install the git hook
pre-commit installThe hook will automatically run cargo fmt --check before each commit and prevent commits with formatting issues.
All PRs must pass formatting checks. The CI pipeline runs:
cargo fmt --check- ensures code is properly formattedcargo clippy- linting and best practicescargo test- all tests must pass
VS Code: Install the rust-analyzer extension and add to settings.json:
{
"rust-analyzer.rustfmt.rangeFormatting.enable": true,
"[rust]": {
"editor.formatOnSave": true
}
}Other IDEs: Configure to run cargo fmt on save or before commit.
All log events follow the pattern: {layer}.{domain}.{action}_{state}
| Layer | Crate | Description |
|---|---|---|
cli |
crates/kild/ |
User-facing CLI commands |
core |
crates/kild-core/ |
Core library logic |
ui |
crates/kild-ui/ |
GPUI native GUI |
peek.cli |
crates/kild-peek/ |
kild-peek CLI commands |
peek.core |
crates/kild-peek-core/ |
kild-peek core library |
// CLI layer (in crates/kild/)
info!(event = "cli.create_started", branch = branch);
info!(event = "cli.list_completed", count = sessions.len());
// Core layer (in crates/kild-core/)
info!(event = "core.session.create_completed", session_id = id);
error!(event = "core.terminal.pid_file_process_check_failed", error = %e);
info!(event = "core.git.worktree.create_started", branch = branch);
// UI layer (in crates/kild-ui/)
info!(event = "ui.watcher.started", path = %sessions_dir.display());
warn!(event = "ui.projects.add_failed", error = %e);
info!(event = "ui.terminal.pty_spawn_completed", pid = pid);
debug!(event = "ui.input.key_translated", key = key_name);
// kild-peek layers (in crates/kild-peek and kild-peek-core)
info!(event = "peek.cli.screenshot_started", window = window_name);
info!(event = "peek.core.screenshot.capture_completed", output_path = %path.display());- Always include the layer prefix (
cli.,core.,ui.,peek.cli.,peek.core.) - Use domain names that match the module (e.g.,
session,terminal,git,cleanup,watcher,projects,input,window,screenshot) - Use
_started/_completed/_failedsuffixes for operation lifecycle events - Sub-domains are allowed for nested concepts (e.g.,
core.git.worktree.create_started,peek.core.screenshot.capture_completed) - Some domains span layers (e.g.,
terminalis used in bothcore.terminal.*for backends andui.terminal.*for rendering)
# Show only CLI events
grep '"event":"cli\.' logs.txt
# Show only core library events
grep '"event":"core\.' logs.txt
# Show only UI events
grep '"event":"ui\.' logs.txt
# Show only kild-peek events
grep '"event":"peek\.' logs.txt
# Show all failures
grep '_failed"' logs.txt
# Show watcher events
grep '"event":"ui\.watcher\.' logs.txt