CLI Reference

Complete reference for the devrail init command.

Installation

devrail init is a single shell script. No package manager is required — run it directly with curl:

curl -fsSL https://devrail.dev/init.sh | bash

Or download it for repeated use:

curl -fsSL https://devrail.dev/init.sh -o devrail-init.sh
chmod +x devrail-init.sh
./devrail-init.sh [options]

Synopsis

devrail init [options]

When run without options, the script launches an interactive wizard that prompts for languages, CI platform, and which adoption layers to install.

Options

OptionDescription
--languages <list>Comma-separated list of languages (e.g., python,bash,go)
--ci <platform>CI platform: github, gitlab, or none
--allInstall all 4 layers (agent files, pre-commit, Makefile, CI)
--agents-onlyInstall only Layer 1 (agent instruction files)
--yesNon-interactive mode; skip existing files without prompting
--forceOverwrite existing files without prompting
--dry-runShow what would be generated without writing any files
--versionPrint the DevRail version and exit
--helpPrint usage information and exit

Supported Languages

The --languages flag accepts any combination of the following:

LanguagePre-commit HooksMakefile Targets
pythonruff (lint + format)ruff check, ruff format, pytest
bashshellcheck, shfmtshellcheck, shfmt
terraformterraform_fmt, terraform_validate, terraform_tflint, terragrunt_fmttflint, terraform fmt
ansibleansible-lintansible-lint
rubyrubocoprubocop, brakeman, bundler-audit
gogolangci-lintgolangci-lint, gofumpt, govulncheck
javascripteslint, prettiereslint, prettier, tsc, npm audit
rustcargo-fmt, cargo-clippycargo fmt, cargo clippy, cargo audit

Adoption Layers

devrail init uses a 4-layer progressive adoption model. In interactive mode, you choose which layers to install. In non-interactive mode, use --all for everything or --agents-only for just Layer 1.

Layer 1: Agent Instruction Files

Files that tell AI coding agents (Claude Code, Cursor, OpenCode) how to work in your project.

FilePurpose
CLAUDE.mdClaude Code agent instructions
AGENTS.mdGeneric agent instructions
.cursorrulesCursor agent instructions
.opencode/agents.yamlOpenCode agent instructions

Layer 2: Pre-commit Hooks

Language-aware .pre-commit-config.yaml with hooks for your declared languages, plus conventional commits and gitleaks secret detection.

Layer 3: Makefile + Container

FilePurpose
MakefileTwo-layer delegation pattern (host → Docker → container)
DEVELOPMENT.mdCanonical development standards reference
.editorconfigEditor formatting rules
.gitignoreStandard ignore patterns (appended if exists)
.gitleaksignoreGitleaks allowlist
.devrail.ymlLanguage declaration and project settings

Layer 4: CI Pipelines

GitHub Actions generates 6 workflow files:

  • .github/workflows/lint.yml
  • .github/workflows/format.yml
  • .github/workflows/test.yml
  • .github/workflows/security.yml
  • .github/workflows/scan.yml
  • .github/workflows/docs.yml

Plus .github/PULL_REQUEST_TEMPLATE.md and .github/CODEOWNERS.

GitLab CI generates:

  • .gitlab-ci.yml (single file with parallel check-stage jobs)
  • .gitlab/merge_request_templates/default.md
  • .gitlab/CODEOWNERS

Conflict Resolution

When devrail init encounters an existing file:

ModeBehavior
Interactive (default)Prompts: [s]kip, [o]verwrite, or [b]ackup + overwrite
--yesSkips existing files (safe, preserves your files)
--forceOverwrites existing files without prompting

Makefile Merge Strategy

ScenarioBehavior
No existing MakefileDevRail Makefile written normally
Existing Makefile with DevRail markersUpdated in-place between markers
Existing non-DevRail MakefileBacked up to Makefile.pre-devrail, DevRail Makefile written, include guidance printed

.gitignore Handling

DevRail patterns are appended below a # --- DevRail --- marker. If the marker already exists, the append is skipped (idempotent).

.devrail.yml Configuration

The script reads .devrail.yml if it exists, or creates one based on the --languages flag or interactive prompts.

# .devrail.yml
languages:
  - python
  - bash

fail_fast: false
log_format: json

Examples

# Interactive mode — walks through all choices
curl -fsSL https://devrail.dev/init.sh | bash

# Greenfield Python project with GitHub Actions
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python --ci github --yes

# Add agent files only to any project
curl -fsSL https://devrail.dev/init.sh | bash -s -- --agents-only --yes

# Preview what would be generated (dry run)
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages go,rust --ci gitlab --dry-run

# Multi-language project with GitLab CI
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python,bash,terraform --ci gitlab --yes

# Force overwrite all existing files
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages javascript --ci github --force

Environment Variables

VariableDefaultDescription
DEVRAIL_VERSIONv1Container image tag used in generated files