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 run self dev

From Leeroopedia
Knowledge Sources
Domains Systems, DevTools
Last Updated 2026-10-18 00:00 GMT

Overview

Concrete tool for enabling self-development mode, building, and launching a self-dev session provided by the jcode CLI.

Description

The run_self_dev function is the entry point for the jcode self-dev CLI subcommand. It resolves the local jcode repository (cloning if needed), optionally builds a fresh binary with the selfdev profile, publishes it to the current build channel, and launches a TUI session connected to the shared or newly-spawned daemon. It handles session resume with reload-state verification, rolling back failed pending activations.

Usage

  • Start a self-dev session: Run jcode self-dev --build to compile and launch.
  • Resume after reload: Run jcode self-dev --resume <session_id> to reconnect after a hot reload.
  • Without building: Run jcode self-dev to connect to an existing self-dev binary without rebuilding.

Code Reference

Source Location

  • Repository: jcode
  • File: src/cli/selfdev.rs

Signature

pub async fn run_self_dev(
    should_build: bool,
    resume_session: Option<String>,
) -> Result<()>

async fn wait_for_reloading_server() -> bool

Import

// Accessed via CLI dispatch, not a public import:
// jcode self-dev [--build] [--resume <session_id>]

I/O Contract

Inputs

Name Type Required Description
should_build bool Yes Whether to compile with --profile selfdev before launching
resume_session Option<String> No Session ID to resume after a hot reload
JCODE_REPO_DIR env var No Override the repo directory for self-dev source
JCODE_RESUMING env var No /// Set when resuming after a reload

Outputs

Name Type Description
return Result<()> Ok on successful TUI launch; Err on build failure, missing binary, or server spawn failure
side effects process Sets CLIENT_SELFDEV_ENV=1, configures canary session, spawns/connects to daemon, launches TUI

Usage Examples

Start Self-Dev With Build

# Build a fresh binary and start a self-dev session
jcode self-dev --build

Resume After Hot Reload

# Reconnect to a self-dev session after the daemon reloaded
jcode self-dev --resume <session_id>

Build and Publish Only

# Build publishes to ~/.jcode/builds/current/jcode
# Subsequent self-dev without --build uses the published binary
jcode self-dev --build
jcode self-dev

Related Pages

Implements Principle

Requires Environment

Uses Heuristics

Page Connections

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