Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:1jehuang Jcode Lib Rs Run

From Leeroopedia
Knowledge Sources
Domains Systems_Architecture, CLI
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for the root crate entry point that re-exports the presentation and application-core layers and exposes the CLI startup runner.

Description

The lib.rs module is the library boundary of the root jcode crate. It re-exports the entire presentation layer (and transitively the application core) via pub use jcode_tui::*, so that existing crate::<module> paths (e.g. crate::config, crate::server, crate::tui) keep resolving unchanged across CLI code that predates the modular split. It declares the cli module and exposes pub async fn run() which delegates to cli::startup::run() — the single entry point invoked by the binary in src/main.rs.

Usage

  • Binary entry: src/main.rs calls jcode::run().await to start the application.
  • Library embedding: Other crates can depend on jcode and call jcode::run() programmatically.
  • Module access: All presentation and app-core modules are reachable through the jcode:: namespace via the re-export.

Code Reference

Source Location

Signature

pub use jcode_tui::*;

pub mod cli;

pub async fn run() -> Result<()>

Import

// The binary entry point (src/main.rs) calls:
use jcode;

jcode::run().await;

I/O Contract

Inputs

Name Type Required Description
(none) — — run() takes no arguments; configuration comes from CLI args and environment

Outputs

Name Type Description
run() returns Result<()> /// Ok on clean exit, Err on startup failure

Usage Examples

Binary Entry Point

// src/main.rs
#[tokio::main]
async fn main() -> anyhow::Result<()> {
    jcode::run().await
}

Programmatic Invocation

use jcode;

// Start the CLI with the same startup logic as the binary
if let Err(e) = jcode::run().await {
    eprintln!("Error: {e}");
    std::process::exit(1);
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment