CLI Reference
Complete reference for all coderaft commands, options, and usage patterns.
Global Options
Section titled “Global Options”All commands support these global options:
--help, -h: Show help information--verbose: Show detailed progress messages
Core Commands
Section titled “Core Commands”coderaft status
Section titled “coderaft status”Show detailed container status and resource usage for a project. With no project specified, prints a quick overview of all coderaft containers.
Syntax:
coderaft status [project]Behavior:
- With a project: shows state, uptime, CPU%, memory usage/%, network I/O, block I/O, PIDs, ports, and mounts
- Without a project: lists all coderaft containers with status and image
Examples:
# Overview of all coderaft containerscoderaft status
# Detailed status for a specific projectcoderaft status myprojectcoderaft up
Section titled “coderaft up”Start a coderaft environment from a shared coderaft.json in the current directory. Perfect for onboarding: clone the repo and run coderaft up.
Syntax:
coderaft up [--dotfiles <path>] [--keep-running]Options:
--dotfiles <path>: Mount a local dotfiles directory into common locations inside the Island--keep-running: Keep the Island running after setup completes (overrides auto-stop-on-idle)
Behavior:
- Reads
./coderaft.json - Creates/starts an Island named
coderaft_<name>where<name>comes fromcoderaft.json’sname(or the folder name) - Applies ports, env, and volumes from configuration
- Runs a system update, then
setup_commands - Installs the coderaft wrapper for nice shell UX
- Records package installations you perform inside the Island to
coderaft.history. Tracked package managers include apt, pip, npm, yarn, pnpm, cargo, go, gem, composer, brew, conda, and many more. Downloads via wget/curl andmake installare also recorded. On rebuilds, these commands are replayed to reproduce the environment. - If global setting
auto_stop_on_exitis enabled (default),coderaft upstops the container right away if it is idle (no exposed ports and only the init process running). Use--keep-runningto leave it running. - When
auto_stop_on_exitis enabled and yourcoderaft.jsondoes not specify arestartpolicy, coderaft uses--restart noto prevent the container from auto-restarting after being stopped.
Examples:
# Start from current folder's coderaft.jsoncoderaft up
# Mount your dotfilescoderaft up --dotfiles ~/.dotfilescoderaft clone
Section titled “coderaft clone”Clone a Git repository and automatically set up a ready-to-code coderaft island. This is the fastest way to start working on an existing project.
Syntax:
coderaft clone <repo-url> [flags]What it does:
- Clones the repository to your coderaft workspace (
~/coderaft/<repo-name>/) - Auto-detects the project’s tech stack (Python, Node.js, Go, Rust, etc.)
- Creates an isolated Docker island with the right tools
- Runs setup commands (installs dependencies)
- Ready to code in seconds
Options:
--force, -f: Force clone, overwriting existing project and island--template, -t <template>: Use specific template instead of auto-detection (python, nodejs, go, web)--name, -n <name>: Override the project name (defaults to repository name)--branch, -b <branch>: Clone a specific branch--depth <n>: Create a shallow clone with specified depth--no-setup: Clone only, don’t create the island
Stack Detection: The command automatically detects your project’s stack by looking for:
- Python:
requirements.txt,setup.py,pyproject.toml,Pipfile,poetry.lock - Node.js:
package.json,yarn.lock,pnpm-lock.yaml - Go:
go.mod,go.sum - Rust:
Cargo.toml - Web:
index.html+package.json
Automatic Dependency Installation: Based on detected files, coderaft runs the appropriate install commands:
- Python:
pip3 install -r requirements.txt,poetry install, etc. - Node.js:
npm ci,yarn install --frozen-lockfile,pnpm install - Go:
go mod download
Examples:
# Clone and auto-setup (most common)coderaft clone https://github.com/user/repo
# Clone SSH URLcoderaft clone git@github.com:user/repo.git
# Override auto-detection with specific templatecoderaft clone https://github.com/user/repo --template nodejs
# Clone specific branchcoderaft clone https://github.com/user/repo --branch develop
# Fast shallow clonecoderaft clone https://github.com/user/repo --depth 1
# Custom project namecoderaft clone https://github.com/user/repo --name my-custom-name
# Clone only, set up later with 'coderaft up'coderaft clone https://github.com/user/repo --no-setupNotes:
- Requires Git to be installed on the host
- If the repository contains a
coderaft.json, it will be used instead of auto-detection - The project is saved to
~/coderaft/<project-name>/
coderaft init
Section titled “coderaft init”Create a new coderaft project with its own Docker island.
Syntax:
coderaft init <project> [flags]Options:
--force, -f: Force initialization, overwriting existing project--template, -t <template>: Initialize from template (python, nodejs, go, web)--generate-config, -g: Generate coderaft.json configuration file--config-only, -c: Generate configuration file only (don’t create Island)
Examples:
# Basic projectcoderaft init myproject
# Python project with templatecoderaft init python-app --template python
# Force overwrite existing projectcoderaft init myproject --force
# Generate config file onlycoderaft init myproject --config-only --template nodejs
# Create with custom configurationcoderaft init webapp --generate-configTemplates:
python: Python 3, pip, venv, build toolsnodejs: Node.js 22, npm, build toolsgo: Go 1.24, git, build toolsweb: Python + Node.js + nginx + flask + django + TypeScript for full-stack development
coderaft shell
Section titled “coderaft shell”Open an interactive bash shell in the project’s Island.
Syntax:
coderaft shell <project> [--keep-running]Examples:
# Enter project environmentcoderaft shell myproject
# Start stopped Island and enter shellcoderaft shell python-appNotes:
- Automatically starts the Island if stopped
- Sets working directory to
/island - Your project files are available at
/island - Exit with
exit,logout, orCtrl+D - By default, the Island stops automatically after you exit the shell when global setting
auto_stop_on_exitis enabled (default) - Use
--keep-runningto keep the Island running after you exit the shell
Island commands:
Once inside the shell, the coderaft command is available as a lightweight wrapper with these subcommands:
| Command | Alias | Description |
|---|---|---|
coderaft exit | quit | Exit the island shell |
coderaft status | info | Show island name, project, hostname, user, working directory |
coderaft history | log | Print recorded package install history from coderaft.history |
coderaft files | ls | List project files in /island |
coderaft disk | usage | Show island root filesystem and /island disk usage |
coderaft env | — | Print all CODERAFT_* environment variables |
coderaft help | -h | Show available island commands |
coderaft version | — | Show island wrapper version |
coderaft run
Section titled “coderaft run”Run an arbitrary command inside the project’s Island.
Syntax:
coderaft run <project> <command> [args...] [--keep-running]Examples:
# Run single commandcoderaft run myproject python3 --version
# Run with argumentscoderaft run myproject apt install -y htop
# Complex command with pipescoderaft run myproject "cd /island && python3 -m http.server 8000"
# Execute scriptcoderaft run myproject bash /island/setup.shNotes:
- Commands run in
/islandby default - Use quotes for complex commands with pipes, redirects, etc.
- Island starts automatically if stopped
- By default, the Island stops automatically after the command finishes when global setting
auto_stop_on_exitis enabled (default) - Use
--keep-runningto keep the Island running after the command finishes
coderaft stop
Section titled “coderaft stop”Stop a project’s Island if it’s running.
Syntax:
coderaft stop <project>Examples:
# Stop a running Islandcoderaft stop myproject
# Stop another project's Islandcoderaft stop webappNotes:
- Safe to run if the Island is already stopped (no-op)
- Complements the default auto-stop behavior after
shellandrun
coderaft destroy
Section titled “coderaft destroy”Stop and remove the project’s Island.
Syntax:
coderaft destroy <project> [flags]Options:
--force, -f: Force destruction without confirmation
Examples:
# Destroy with confirmationcoderaft destroy myproject
# Force destroy without promptcoderaft destroy myproject --forceNotes:
- Preserves project files in
~/coderaft/<project>/ - Island can be recreated with
coderaft init - Use
rm -rf ~/coderaft/<project>/to remove files
coderaft list
Section titled “coderaft list”Show all managed projects and their Island status.
Syntax:
coderaft list [flags]Options:
--verbose, -v: Show detailed information including configuration
Examples:
# Basic listcoderaft list
# Detailed informationcoderaft list --verboseOutput Format:
CODERAFT PROJECTSPROJECT Island STATUS CONFIG WORKSPACE-------------------- -------------------- --------------- ------------ ------------------------------myproject coderaft_myproject Up 2 hours coderaft.json /home/user/coderaft/myprojectwebapp coderaft_webapp Exited none /home/user/coderaft/webapp
Total projects: 2coderaft lock
Section titled “coderaft lock”Generate a deterministic, checksummed environment snapshot as coderaft.lock.json for a project. This is ideal for sharing/auditing the exact Island image, container configuration, and globally installed packages.
Syntax:
coderaft lock <project> [-o, --output <path>]Options:
-o, --output <path>: Write the lock file to a custom path. Defaults to<workspace>/coderaft.lock.json.
Behavior:
- Ensures the project’s Island is running (starts it if needed).
- Inspects the container and its image to capture:
- Base image: name, digest, image ID
- Container config: working_dir, user, restart policy, network, ports, volumes, labels, environment, capabilities, resources (cpus/memory)
- Installed package snapshots (all sorted alphabetically for determinism):
- System: apt, apk, dnf, pacman, brew, snap
- Python: pip, pipx, conda, poetry
- Node.js: npm, yarn, pnpm, bun
- Languages: cargo (Rust), go (Go binaries), gem (Ruby), composer (PHP)
- Registries and sources:
- pip:
index-urlandextra-index-url - npm/yarn/pnpm: global registry URLs
- apt:
sources.listlines, snapshot base URL, OS release codename
- pip:
- Computes a SHA-256 checksum over all reproducibility-critical fields (base image, packages, registries, apt sources).
- If
coderaft.jsonexists in the workspace, includes itssetup_commandsfor context.
Use coderaft apply to reconcile an island to a lock file and coderaft verify to check for drift.
Examples:
# Write snapshot into the project workspacecoderaft lock myproject
# Write snapshot to a custom filecoderaft lock myproject -o ./env/coderaft.lock.jsonSample Output (excerpt):
{ "version": 2, "project": "myproject", "ISLAND_NAME": "coderaft_myproject", "created_at": "2026-02-12T20:41:51Z", "checksum": "sha256:a1b2c3d4e5f6...", "base_image": { "name": "buildpack-deps:bookworm", "digest": "buildpack-deps@sha256:...", "id": "sha256:..." }, "container": { "working_dir": "/island", "user": "root", "restart": "no", "network": "bridge", "ports": ["3000/tcp -> 0.0.0.0:3000"], "volumes": ["bind /host/path -> /island (rw=true)"], "environment": {"TZ": "UTC"}, "labels": {"coderaft.project": "myproject"}, "capabilities": ["SYS_PTRACE"], "resources": {"cpus": "2", "memory": "2048MB"} }, "packages": { "apt": ["build-essential=12.9ubuntu3", "git=1:2.34.1-..."], "pip": ["flask==3.1.0", "requests==2.32.3"], "npm": ["typescript@5.6.2"], "yarn": ["eslint@9.1.0"], "pnpm": [], "cargo": ["ripgrep=14.1.0"], "go": ["gopls", "golangci-lint"], "gem": ["bundler=2.5.6"], "bun": [] }, "registries": { "pip_index_url": "https://pypi.org/simple", "pip_extra_index_urls": ["https://mirror.example/simple"], "npm_registry": "https://registry.npmjs.org/", "yarn_registry": "https://registry.yarnpkg.com", "pnpm_registry": "https://registry.npmjs.org/" }, "apt_sources": { "snapshot_url": "https://snapshot.debian.org/archive/debian/20240915T000000Z/", "sources_lists": [ "deb https://snapshot.debian.org/archive/debian/20240915T000000Z/ bullseye main" ], "pinned_release": "jammy" }, "setup_commands": [ "apt install -y python3 python3-pip" ]}coderaft verify
Section titled “coderaft verify”Validate that the running Island matches the coderaft.lock.json exactly. Reports detailed per-package drift.
Syntax:
coderaft verify <project>Checks:
- Base image digest (if recorded in lock)
- Package sets: apt, pip, npm, yarn, pnpm — with per-package detail:
- Packages added on the island but not in the lock
- Packages removed from the island but present in the lock
- Packages with changed versions
- Registries: pip index/extra-index, npm/yarn/pnpm registry URLs
- Apt sources: sources.list lines, snapshot base URL (if present), OS release codename
- Lock checksum (v2+): recomputed from live state for a fast-path comparison
Note: The lock file captures packages from all supported package managers (cargo, go, gem, etc.), but verify currently checks apt/pip/npm/yarn/pnpm only.
Returns non-zero on any mismatch and prints a categorized drift report.
Example:
coderaft verify myprojectSample drift output:
ERROR verification failed — 3 drift(s) detected: apt packages drifted: +1 added, -0 removed, ~1 changed + vim=2:8.2.3995-1ubuntu2 ~ git: 1:2.34.1-1ubuntu1.10 → 1:2.34.1-1ubuntu1.11 pip packages drifted: +0 added, -1 removed, ~0 changed - flask==3.0.0coderaft apply
Section titled “coderaft apply”Apply the coderaft.lock.json to the running Island: configure registries and apt sources, then reconcile package sets to match the lock.
Syntax:
coderaft apply <project> [--dry-run]Options:
--dry-run: Preview the registry/source commands and package reconciliation steps without modifying the island.
Behavior:
- Registries:
- Writes
/etc/pip.confwithindex-url/extra-index-urlfrom lock - Runs
npm/yarn/pnpmconfig to set global registry URLs
- Writes
- Apt sources:
- Backs up and rewrites
/etc/apt/sources.list, clears/etc/apt/sources.list.d/*.list - Optionally sets a default release hint, then
apt update
- Backs up and rewrites
- Reconciliation:
- APT: install exact versions from lock, remove extras, autoremove
- Pip: install missing exact versions, uninstall extras
- npm/yarn/pnpm (global): add missing exact versions, remove extras
Note: Apply currently reconciles apt/pip/npm/yarn/pnpm packages. Other package managers captured in the lock file (cargo, go, gem, etc.) are recorded for reference but not auto-applied.
Exits non-zero if application fails at any step.
Examples:
# Apply the lock filecoderaft apply myproject
# Preview what would changecoderaft apply myproject --dry-runcoderaft diff
Section titled “coderaft diff”Compare the coderaft.lock.json with the live state of the running Island and display a colorized, human-readable diff.
Syntax:
coderaft diff <project>Behavior:
- Reads
coderaft.lock.jsonfrom the project workspace (errors if missing; suggestscoderaft lockfirst) - Starts the island if not already running
- Gathers live container state in parallel: packages (apt, pip, npm, yarn, pnpm), registries, apt sources, base image digest, and container config
- Compares each section against the lock file and prints grouped differences with
+(added),-(removed),~(changed) markers - If the island matches the lock file, prints “no differences”
- This is a read-only operation — nothing is modified
Example:
coderaft diff myprojectSample output:
Base Image: ~ digest: sha256:abc123... → sha256:def456...
Packages (apt): + vim=2:8.2.3995-1ubuntu2 ~ git: 1:2.34.1-1ubuntu1.10 → 1:2.34.1-1ubuntu1.11
Packages (pip): - flask==3.0.0Notes:
- Use
coderaft verifyfor a pass/fail check (suitable for CI) - Use
coderaft applyto reconcile the island to match the lock - Use
coderaft difffor a detailed visual comparison
Configuration Commands
Section titled “Configuration Commands”coderaft backup
Section titled “coderaft backup”Backup a project’s Island state and configuration into a portable directory.
Syntax:
coderaft backup <project> [--output <dir>]Options:
--output, -o <dir>: Output directory for backup (default:<workspace>/.coderaft_backups/<timestamp>)
Behavior:
- Commits the running Island to a Docker image
- Saves the image as
image.tar - Writes a
metadata.jsonmanifest with project name, island name, image tag, coderaft config, and lock file contents
Example:
# Backup with automatic timestampscoderaft backup myproject
# Specify a custom backup directorycoderaft backup myproject --output /tmp/myproject-backupcoderaft restore
Section titled “coderaft restore”Restore a project’s Island from a backup directory created by coderaft backup.
Syntax:
coderaft restore <project> <backup-dir> [--force]Options:
--force, -f: Overwrite the existing Island if it already exists
Behavior:
- Loads
image.tarfrom the backup directory - Reads
metadata.jsonfor the image tag - Creates a new Island from the restored image
- Starts the Island and sets up the coderaft wrapper
Example:
# Restore from a backupcoderaft restore myproject ~/backups/myproject/20250101-120000
# Force overwrite an existing islandcoderaft restore myproject ~/backups/myproject/20250101-120000 --forcecoderaft export
Section titled “coderaft export”Create a portable .tar.gz archive containing the Island image snapshot, configuration, and lock file. The archive can be transferred to another machine and restored with coderaft restore.
Syntax:
coderaft export <project> [--output <path>]Options:
--output, -o <path>: Output file path (default:<workspace>/<project>-export-<timestamp>.tar.gz)
Behavior:
- Commits the running container to a temporary Docker image
- Saves the image as
image.tar - Bundles into a
.tar.gzarchive containing:image.tar— Docker image snapshotcoderaft.json— project configuration (if present)coderaft.lock.json— environment lock file (if present)manifest.json— metadata (version, project name, image tag, island name, export timestamp)
- Removes the temporary export image after archiving
Examples:
# Export with default filenamecoderaft export myproject
# Export to a specific pathcoderaft export myproject -o ./myproject-portable.tar.gzNotes:
- The island must exist before exporting (run
coderaft uporcoderaft initfirst) - Use
coderaft restoreto import the archive on another machine
coderaft devcontainer generate
Section titled “coderaft devcontainer generate”Generate a VS Code .devcontainer/devcontainer.json from the current project’s coderaft.json.
Syntax:
coderaft devcontainer generateBehavior:
- Reads
coderaft.jsonfrom the current directory - Maps base image, ports, environment variables, volumes, and setup commands into a
devcontainer.json - Writes
.devcontainer/devcontainer.json
Example:
cd ~/coderaft/myprojectcoderaft devcontainer generate
# Then open in VS Code → "Reopen in Container"coderaft templates
Section titled “coderaft templates”Manage coderaft project templates (built-in and user-defined).
Subcommands:
coderaft templates list
Section titled “coderaft templates list”List available templates (built-in + user templates in ~/.coderaft/templates).
Syntax:
coderaft templates listcoderaft templates show
Section titled “coderaft templates show”Show a template’s JSON (name, description, and config).
Syntax:
coderaft templates show <name>coderaft templates create
Section titled “coderaft templates create”Create coderaft.json in the current directory from a template.
Syntax:
coderaft templates create <name> [project]Examples:
cd ~/coderaft/myappcoderaft templates create python MyApp
# If project name omitted, folder name is usedcoderaft templates create nodejscoderaft templates save
Section titled “coderaft templates save”Save the current folder’s coderaft.json as a reusable user template in ~/.coderaft/templates/<name>.json.
Syntax:
coderaft templates save <name>coderaft templates delete
Section titled “coderaft templates delete”Delete a user template by name.
Syntax:
coderaft templates delete <name>coderaft config
Section titled “coderaft config”Manage coderaft configurations.
Subcommands:
coderaft config generate
Section titled “coderaft config generate”Generate coderaft.json configuration file for a project.
Syntax:
coderaft config generate <project> [flags]Options:
--template, -t <template>: Use template configuration
Examples:
# Generate basic configcoderaft config generate myproject
# Generate with templatecoderaft config generate myproject --template pythoncoderaft config validate
Section titled “coderaft config validate”Validate project configuration file.
Syntax:
coderaft config validate <project>coderaft config show
Section titled “coderaft config show”Display project configuration details.
Syntax:
coderaft config show <project>Note: Template listing and management has moved to the top-level coderaft templates command.
coderaft config schema
Section titled “coderaft config schema”Print the JSON Schema for coderaft.json, useful for editor validation and autocompletion.
Syntax:
coderaft config schemacoderaft config global
Section titled “coderaft config global”Show global coderaft configuration.
Syntax:
coderaft config globalMaintenance Commands
Section titled “Maintenance Commands”coderaft version
Section titled “coderaft version”Display the version information for coderaft.
Syntax:
coderaft versionExamples:
# Display version informationcoderaft versionOutput Format:
coderaft (v1.0, linux/amd64)coderaft cleanup
Section titled “coderaft cleanup”Clean up Docker resources and coderaft artifacts.
Syntax:
coderaft cleanup [flags]Options:
--orphaned: Remove orphaned containers only--images: Remove unused images only--volumes: Remove unused volumes only--networks: Remove unused networks only--system-prune: Run docker system prune--all: Clean up everything--dry-run: Show what would be cleaned (no changes)--force: Skip confirmation prompts
Examples:
# Interactive cleanup menucoderaft cleanup
# Clean specific resourcescoderaft cleanup --orphanedcoderaft cleanup --images
# Comprehensive cleanupcoderaft cleanup --all
# Preview cleanup actionscoderaft cleanup --dry-run --all
# Cleanup without promptscoderaft cleanup --all --forcecoderaft maintenance
Section titled “coderaft maintenance”Perform maintenance tasks on coderaft projects and Islands.
Syntax:
coderaft maintenance [flags]Options:
--status: Show detailed system status--health-check: Check health of all projects--update: Update all Islands--restart: Restart stopped Islands--rebuild: Rebuild all Islands--auto-repair: Auto-fix common issues--force: Skip confirmation prompts
Examples:
# Interactive maintenance menucoderaft maintenance
# Individual taskscoderaft maintenance --health-checkcoderaft maintenance --updatecoderaft maintenance --restart
# Combined operationscoderaft maintenance --health-check --update --restart
# Auto-repair issuescoderaft maintenance --auto-repair
# Force operations without promptscoderaft maintenance --force --rebuildcoderaft update
Section titled “coderaft update”Pull the latest base image(s) and rebuild environment Island(es).
This command replaces Islands to ensure they are based on the newest upstream images, while preserving your workspace files on the host.
Syntax:
coderaft update [project]Behavior:
- When a project is specified, only that environment is updated
- With no project, all registered projects are updated
- Pulls the latest base image, recreates the Island with current coderaft.json config, and re-runs setup commands
- Replays package install commands from
coderaft.historyto restore your previously installed packages
Options:
- None currently. Uses your existing configuration in
coderaft.jsonif present.
Examples:
# Update a single projectcoderaft update myproject
# Update all projectscoderaft updateNotes:
- Your files remain in ~/coderaft/
/ and are re-mounted into the new Island - If the project has a coderaft.json, its settings (ports, env, volumes, etc.) are applied on rebuild
- System packages inside the Island are updated as part of the rebuild
- If the Island exists, it will be stopped and replaced; if missing, it will be created
coderaft hooks
Section titled “coderaft hooks”Manage git pre-commit hook integration that runs coderaft verify before each commit to detect environment drift.
Subcommands:
coderaft hooks install
Section titled “coderaft hooks install”Install a git pre-commit hook that runs coderaft verify before each commit.
Syntax:
coderaft hooks install <project>Behavior:
- Locates the
.gitdirectory in the project workspace (errors if not a git repo) - If a pre-commit hook already exists, appends the coderaft hook block (compatible with husky, lefthook, etc.)
- If no pre-commit hook exists, creates a new one
- The hook checks for
coderaft.lock.jsonand runscoderaft verify - If verification fails, the commit is blocked with instructions to run
coderaft lockorcoderaft apply - Users can bypass with
git commit --no-verify
Example:
coderaft hooks install myprojectcoderaft hooks remove
Section titled “coderaft hooks remove”Remove the coderaft pre-commit hook.
Syntax:
coderaft hooks remove <project>Behavior:
- Strips the coderaft hook block from the pre-commit file
- If nothing meaningful remains after removal, deletes the hook file entirely
- Otherwise, preserves other hook content
Example:
coderaft hooks remove myprojectcoderaft secrets
Section titled “coderaft secrets”Manage encrypted secrets for coderaft projects. Secrets are stored in an AES-256-GCM encrypted vault and can be injected into islands as environment variables.
Subcommands:
coderaft secrets init
Section titled “coderaft secrets init”Initialize the secrets vault with a master password.
Syntax:
coderaft secrets initBehavior:
- Creates an encrypted vault at
~/.coderaft/secrets.vault.json - Prompts for a master password (minimum 8 characters)
- Uses PBKDF2 key derivation with 100,000 iterations
- This password cannot be recovered if lost
Example:
coderaft secrets init# Enter master password: ********# Confirm password: ********# done: secrets vault initializedcoderaft secrets set
Section titled “coderaft secrets set”Store an encrypted secret for a project.
Syntax:
coderaft secrets set <project> <KEY>[=value]Behavior:
- If
=valueis provided, uses the inline value - Otherwise, prompts for the value (hidden input)
- Encrypts and stores in the vault
Examples:
# Prompt for value (recommended for sensitive data)coderaft secrets set myproject API_KEY
# Inline valuecoderaft secrets set myproject DATABASE_URL=postgres://localhost/dbcoderaft secrets get
Section titled “coderaft secrets get”Retrieve and decrypt a secret.
Syntax:
coderaft secrets get <project> <KEY>Example:
coderaft secrets get myproject API_KEY# sk-12345...coderaft secrets list
Section titled “coderaft secrets list”List all secrets (keys only, not values).
Syntax:
coderaft secrets list [project]Examples:
# List all projects with secretscoderaft secrets list
# List secrets for a specific projectcoderaft secrets list myprojectcoderaft secrets remove
Section titled “coderaft secrets remove”Remove a secret from the vault.
Syntax:
coderaft secrets remove <project> <KEY>Example:
coderaft secrets remove myproject OLD_API_KEYcoderaft secrets import
Section titled “coderaft secrets import”Import secrets from a .env file into the encrypted vault.
Syntax:
coderaft secrets import <project> <envfile>Behavior:
- Parses standard
.envfile format (supportsexportprefix, quotes, comments) - Encrypts each key-value pair and stores in the vault
- Existing keys with same name are overwritten
Examples:
coderaft secrets import myproject .envcoderaft secrets import myproject .env.productioncoderaft secrets export
Section titled “coderaft secrets export”Export secrets as shell-compatible environment variable declarations.
Syntax:
coderaft secrets export <project>Examples:
# Pipe to eval for current shelleval $(coderaft secrets export myproject)
# Save to .env filecoderaft secrets export myproject > .env.localOutput format:
export API_KEY="sk-12345..."export DATABASE_URL="postgres://localhost/db"coderaft ports
Section titled “coderaft ports”Display forwarded ports for running islands with clickable URLs and service detection.
Syntax:
coderaft ports [project]Behavior:
- Shows all exposed ports with host→container mapping
- Generates clickable
http://localhost:PORTURLs for web ports - Auto-detects common services (PostgreSQL, Redis, MongoDB, etc.)
- Without a project argument, shows ports for all running islands
Examples:
# Show ports for all running islandscoderaft ports
# Show ports for a specific projectcoderaft ports myprojectSample Output:
exposed ports
PROJECT PORT URL SERVICE------- ---- --- -------myproject 3000→3000 http://localhost:3000 Dev Servermyproject 5432→5432 PostgreSQLmyproject 6379→6379 Redis
tip: click URLs to open in browser (terminal-dependent)Detected Services:
| Port | Service |
|---|---|
| 22 | SSH |
| 80, 8080 | HTTP |
| 443, 8443 | HTTPS |
| 3000, 3001 | Dev Server |
| 4000 | Phoenix |
| 5000 | Flask/Dev |
| 5173 | Vite |
| 5432 | PostgreSQL |
| 6379 | Redis |
| 8000 | Django/Uvicorn |
| 8888 | Jupyter |
| 9229 | Node Debug |
| 27017 | MongoDB |
coderaft ports watch
Section titled “coderaft ports watch”Monitor ports in real-time (displays current state and provides refresh instructions).
Syntax:
coderaft ports watch [project]Exit Codes
Section titled “Exit Codes”Coderaft uses standard exit codes:
0: Success1: General error2: Invalid arguments or usage125: Docker daemon not running126: Container not executable127: Container/command not found
Environment Variables
Section titled “Environment Variables”Coderaft respects these environment variables:
Host-side (affects the coderaft CLI)
Section titled “Host-side (affects the coderaft CLI)”| Variable | Default | Description |
|---|---|---|
DOCKER_HOST | system default | Docker daemon socket |
CODERAFT_HOME | ~/.coderaft | Override default coderaft configuration directory |
CODERAFT_WORKSPACE | ~/coderaft | Override default project workspace directory |
CODERAFT_ENGINE | docker | Container engine binary. Set to podman or another docker-compatible CLI to use an alternative engine |
CODERAFT_STOP_TIMEOUT | 2 (seconds) | Timeout for docker stop when stopping an island. Set to 0 for immediate kill |
CODERAFT_DISABLE_PARALLEL | false | Set to true to disable parallel operations (falls back to sequential execution) |
CODERAFT_MAX_WORKERS | 4 | Maximum number of general parallel workers |
CODERAFT_SETUP_WORKERS | 3 | Number of parallel workers for setup commands |
CODERAFT_QUERY_WORKERS | 5 | Number of parallel workers for package query operations (used by lock, diff, verify) |
Island-side (inside the container)
Section titled “Island-side (inside the container)”| Variable | Default | Description |
|---|---|---|
CODERAFT_ISLAND_NAME | (set automatically) | Name of the current island |
CODERAFT_PROJECT_NAME | (set automatically) | Name of the current project |
CODERAFT_HISTORY | /island/coderaft.history | Path where package install/remove commands are recorded. Set to empty to disable recording |
CODERAFT_LOCKFILE | (deprecated) | Legacy name for CODERAFT_HISTORY. Honored if set and CODERAFT_HISTORY has not been explicitly overridden |
Project Structure
Section titled “Project Structure”When you create a project, coderaft sets up:
~/coderaft/<project>/ # Project workspace (host)├── coderaft.json # Configuration file (optional)├── coderaft.lock.json # Environment lock file (optional)├── your-files... # Your project files└── ...
~/.coderaft/ # Global configuration├── config.json # Global settings and project registry├── secrets.vault.json # Encrypted secrets vault (AES-256-GCM)└── templates/ # User-defined templates └── *.jsonInside Island:
/island/ # Mounted from ~/coderaft/<project>/├── coderaft.json # Same files as host├── coderaft.history # Package install history (auto-generated)├── your-files...└── ...Shell Completion
Section titled “Shell Completion”coderaft completion
Section titled “coderaft completion”Generate completion scripts for your shell to enable tab autocompletion for coderaft commands, flags, project names, and template names.
Syntax:
coderaft completion [bash|zsh|fish|powershell]Supported Shells:
- Bash: Autocompletion for commands, flags, project names, and templates (Linux/macOS)
- Zsh: Full autocompletion with descriptions (Linux/macOS)
- Fish: Intelligent completion with suggestions (Linux/macOS)
- PowerShell: Tab completion with descriptions (Windows)
Setup Instructions:
Bash:
# Load completion for current sessionsource <(coderaft completion bash)
# Install for all sessions (Linux)sudo coderaft completion bash > /etc/bash_completion.d/coderaftZsh:
# Enable completion if not already enabledecho "autoload -U compinit; compinit" >> ~/.zshrc
# Install for all sessionscoderaft completion zsh > "${fpath[1]}/_coderaft"
# Restart your shell or source ~/.zshrcFish:
# Load completion for current sessioncoderaft completion fish | source
# Install for all sessionscoderaft completion fish > ~/.config/fish/completions/coderaft.fishPowerShell:
# Load completion for current sessioncoderaft completion powershell | Out-String | Invoke-Expression
# Install for all sessions (add to your profile)coderaft completion powershell >> $PROFILEWhat Gets Completed:
- Command names (
init,shell,run,list, etc.) - Command flags (
--template,--force,--keep-running) - Project names for commands like
shell,run,stop,destroy - Template names for
--templateflag andtemplates show/delete
Examples:
# Tab completion examples (press TAB after typing)coderaft <TAB> # Shows: init, shell, run, list, etc.coderaft shell <TAB> # Shows: your-project-namescoderaft init myapp --template <TAB> # Shows: python, nodejs, go, webcoderaft templates show <TAB> # Shows: available-template-namesDocker Integration
Section titled “Docker Integration”Coderaft creates Islands (Docker containers) with these characteristics:
- Name:
coderaft_<project> - Base Image:
buildpack-deps:bookworm(configurable) - Working Directory:
/island - Mount:
~/coderaft/<project>→/island - Restart Policy:
unless-stopped(ornowhenauto_stop_on_exitis enabled and no explicit policy is set) - Command:
sleep infinity(keeps Island alive)
Docker Commands Equivalent:
# coderaft init myprojectdocker create --name coderaft_myproject \ --restart unless-stopped \ -v ~/coderaft/myproject:/island \ -w /island \ buildpack-deps:bookworm sleep infinity
# coderaft shell myprojectdocker start coderaft_myprojectdocker exec -it coderaft_myproject bash
# coderaft run myproject <command>docker exec coderaft_myproject <command>
# coderaft destroy myprojectdocker stop coderaft_myprojectdocker rm coderaft_myproject