Skip to content

Commit 7ffc2a6

Browse files
docs(getting-started): add devrail init distribution and CLI reference
Add _redirects file for curl-pipe-bash distribution via devrail.dev/init.sh. Update getting-started guides to lead with devrail init as the primary adoption path, and add a CLI reference page documenting all options. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f7f20ea commit 7ffc2a6

File tree

5 files changed

+314
-129
lines changed

5 files changed

+314
-129
lines changed

content/docs/getting-started/_index.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,28 @@
22
title: "Getting Started"
33
linkTitle: "Getting Started"
44
weight: 10
5-
description: "Quick start guides for creating new DevRail projects and retrofitting existing repositories."
5+
description: "Get up and running with DevRail in minutes using devrail init."
66
---
77

8-
Get up and running with DevRail in minutes. Whether you are starting a brand-new project or adding DevRail standards to an existing repository, the process is straightforward.
8+
Get up and running with DevRail in minutes. The `devrail init` script generates all DevRail configuration files in your project directory with a single command.
9+
10+
## Quick Start
11+
12+
```bash
13+
# Run devrail init in your project directory
14+
curl -fsSL https://devrail.dev/init.sh | bash
15+
```
16+
17+
This launches an interactive wizard that asks which languages you use, which CI platform you want (GitHub Actions or GitLab CI), and which DevRail layers to install. It generates all configuration files, handles existing file conflicts safely, and is idempotent (safe to re-run).
18+
19+
For non-interactive use:
20+
21+
```bash
22+
# Generate everything for a Python project with GitHub Actions
23+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python --ci github --yes
24+
```
25+
26+
See the [CLI Reference](/docs/getting-started/cli-reference/) for all options.
927

1028
## Prerequisites
1129

@@ -21,14 +39,15 @@ All other tools (linters, formatters, security scanners, test runners) are pre-i
2139

2240
## Choose Your Path
2341

24-
- **[New Project](/docs/getting-started/new-project/)** -- Start a new repository from a DevRail template. All configuration files are pre-set.
42+
- **[New Project](/docs/getting-started/new-project/)** -- Start a new repository with `devrail init` or from a template.
2543
- **[Retrofit Existing Project](/docs/getting-started/retrofit/)** -- Add DevRail standards to a repository you already have.
2644
- **[Working with AI Agents](/docs/getting-started/agents/)** -- Get AI coding agents to follow DevRail standards in your projects.
45+
- **[CLI Reference](/docs/getting-started/cli-reference/)** -- Full `devrail init` command reference.
2746
- **[Compliance Badge](/docs/getting-started/badge/)** -- Add a DevRail compliance badge to your README.
2847

2948
## Verify Your Setup
3049

31-
After setting up DevRail (either path), verify everything works by running:
50+
After setting up DevRail (any path), verify everything works by running:
3251

3352
```bash
3453
# Run all DevRail checks (linting, formatting, security, tests)
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
---
2+
title: "CLI Reference"
3+
linkTitle: "CLI Reference"
4+
weight: 25
5+
description: "Complete reference for the devrail init command."
6+
---
7+
8+
## Installation
9+
10+
`devrail init` is a single shell script. No package manager is required — run it directly with `curl`:
11+
12+
```bash
13+
curl -fsSL https://devrail.dev/init.sh | bash
14+
```
15+
16+
Or download it for repeated use:
17+
18+
```bash
19+
curl -fsSL https://devrail.dev/init.sh -o devrail-init.sh
20+
chmod +x devrail-init.sh
21+
./devrail-init.sh [options]
22+
```
23+
24+
## Synopsis
25+
26+
```
27+
devrail init [options]
28+
```
29+
30+
When run without options, the script launches an interactive wizard that prompts for languages, CI platform, and which adoption layers to install.
31+
32+
## Options
33+
34+
| Option | Description |
35+
|---|---|
36+
| `--languages <list>` | Comma-separated list of languages (e.g., `python,bash,go`) |
37+
| `--ci <platform>` | CI platform: `github`, `gitlab`, or `none` |
38+
| `--all` | Install all 4 layers (agent files, pre-commit, Makefile, CI) |
39+
| `--agents-only` | Install only Layer 1 (agent instruction files) |
40+
| `--yes` | Non-interactive mode; skip existing files without prompting |
41+
| `--force` | Overwrite existing files without prompting |
42+
| `--dry-run` | Show what would be generated without writing any files |
43+
| `--version` | Print the DevRail version and exit |
44+
| `--help` | Print usage information and exit |
45+
46+
## Supported Languages
47+
48+
The `--languages` flag accepts any combination of the following:
49+
50+
| Language | Pre-commit Hooks | Makefile Targets |
51+
|---|---|---|
52+
| `python` | ruff (lint + format) | ruff check, ruff format, pytest |
53+
| `bash` | shellcheck, shfmt | shellcheck, shfmt |
54+
| `terraform` | terraform_fmt, terraform_validate, terraform_tflint, terragrunt_fmt | tflint, terraform fmt |
55+
| `ansible` | ansible-lint | ansible-lint |
56+
| `ruby` | rubocop | rubocop, brakeman, bundler-audit |
57+
| `go` | golangci-lint | golangci-lint, gofumpt, govulncheck |
58+
| `javascript` | eslint, prettier | eslint, prettier, tsc, npm audit |
59+
| `rust` | cargo-fmt, cargo-clippy | cargo fmt, cargo clippy, cargo audit |
60+
61+
## Adoption Layers
62+
63+
`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.
64+
65+
### Layer 1: Agent Instruction Files
66+
67+
Files that tell AI coding agents (Claude Code, Cursor, OpenCode) how to work in your project.
68+
69+
| File | Purpose |
70+
|---|---|
71+
| `CLAUDE.md` | Claude Code agent instructions |
72+
| `AGENTS.md` | Generic agent instructions |
73+
| `.cursorrules` | Cursor agent instructions |
74+
| `.opencode/agents.yaml` | OpenCode agent instructions |
75+
76+
### Layer 2: Pre-commit Hooks
77+
78+
Language-aware `.pre-commit-config.yaml` with hooks for your declared languages, plus conventional commits and gitleaks secret detection.
79+
80+
### Layer 3: Makefile + Container
81+
82+
| File | Purpose |
83+
|---|---|
84+
| `Makefile` | Two-layer delegation pattern (host → Docker → container) |
85+
| `DEVELOPMENT.md` | Canonical development standards reference |
86+
| `.editorconfig` | Editor formatting rules |
87+
| `.gitignore` | Standard ignore patterns (appended if exists) |
88+
| `.gitleaksignore` | Gitleaks allowlist |
89+
| `.devrail.yml` | Language declaration and project settings |
90+
91+
### Layer 4: CI Pipelines
92+
93+
**GitHub Actions** generates 6 workflow files:
94+
95+
- `.github/workflows/lint.yml`
96+
- `.github/workflows/format.yml`
97+
- `.github/workflows/test.yml`
98+
- `.github/workflows/security.yml`
99+
- `.github/workflows/scan.yml`
100+
- `.github/workflows/docs.yml`
101+
102+
Plus `.github/PULL_REQUEST_TEMPLATE.md` and `.github/CODEOWNERS`.
103+
104+
**GitLab CI** generates:
105+
106+
- `.gitlab-ci.yml` (single file with parallel check-stage jobs)
107+
- `.gitlab/merge_request_templates/default.md`
108+
- `.gitlab/CODEOWNERS`
109+
110+
## Conflict Resolution
111+
112+
When `devrail init` encounters an existing file:
113+
114+
| Mode | Behavior |
115+
|---|---|
116+
| Interactive (default) | Prompts: **[s]kip**, **[o]verwrite**, or **[b]ackup + overwrite** |
117+
| `--yes` | Skips existing files (safe, preserves your files) |
118+
| `--force` | Overwrites existing files without prompting |
119+
120+
### Makefile Merge Strategy
121+
122+
| Scenario | Behavior |
123+
|---|---|
124+
| No existing Makefile | DevRail Makefile written normally |
125+
| Existing Makefile with DevRail markers | Updated in-place between markers |
126+
| Existing non-DevRail Makefile | Backed up to `Makefile.pre-devrail`, DevRail Makefile written, include guidance printed |
127+
128+
### .gitignore Handling
129+
130+
DevRail patterns are appended below a `# --- DevRail ---` marker. If the marker already exists, the append is skipped (idempotent).
131+
132+
## `.devrail.yml` Configuration
133+
134+
The script reads `.devrail.yml` if it exists, or creates one based on the `--languages` flag or interactive prompts.
135+
136+
```yaml
137+
# .devrail.yml
138+
languages:
139+
- python
140+
- bash
141+
142+
fail_fast: false
143+
log_format: json
144+
```
145+
146+
## Examples
147+
148+
```bash
149+
# Interactive mode — walks through all choices
150+
curl -fsSL https://devrail.dev/init.sh | bash
151+
152+
# Greenfield Python project with GitHub Actions
153+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python --ci github --yes
154+
155+
# Add agent files only to any project
156+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --agents-only --yes
157+
158+
# Preview what would be generated (dry run)
159+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages go,rust --ci gitlab --dry-run
160+
161+
# Multi-language project with GitLab CI
162+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python,bash,terraform --ci gitlab --yes
163+
164+
# Force overwrite all existing files
165+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages javascript --ci github --force
166+
```
167+
168+
## Environment Variables
169+
170+
| Variable | Default | Description |
171+
|---|---|---|
172+
| `DEVRAIL_VERSION` | `v1` | Container image tag used in generated files |

content/docs/getting-started/new-project.md

Lines changed: 48 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,74 +2,57 @@
22
title: "New Project"
33
linkTitle: "New Project"
44
weight: 10
5-
description: "Create a new DevRail-compliant project from a GitHub or GitLab template."
5+
description: "Create a new DevRail-compliant project using devrail init or a template."
66
---
77

8-
The fastest way to start a DevRail-compliant project is to create a repository from one of the official templates. All DevRail configuration files are included and pre-configured.
8+
## Recommended: `devrail init`
99

10-
## From GitHub Template
11-
12-
### Step 1: Create the Repository
13-
14-
Navigate to the [DevRail GitHub template](https://github.com/devrail-dev/github-repo-template) and click **"Use this template"** to create a new repository in your organization or personal account.
15-
16-
Alternatively, use the GitHub CLI:
10+
The fastest way to start a new DevRail project is `devrail init`. Run it in an empty directory (or a freshly initialized git repo) and it generates all configuration files:
1711

1812
```bash
19-
# Create a new repository from the DevRail GitHub template
20-
gh repo create my-new-project --template devrail-dev/github-repo-template --public
21-
cd my-new-project
22-
```
23-
24-
### Step 2: Configure Your Languages
25-
26-
Edit `.devrail.yml` to declare which languages your project uses. The Makefile reads this file to determine which tools to run.
13+
mkdir my-new-project && cd my-new-project
14+
git init
2715

28-
```yaml
29-
# .devrail.yml -- declare your project's languages
30-
languages:
31-
- python
32-
- bash
16+
# Interactive mode — prompts for languages and CI platform
17+
curl -fsSL https://devrail.dev/init.sh | bash
3318

34-
fail_fast: false
35-
log_format: json
19+
# Or non-interactive — specify everything up front
20+
curl -fsSL https://devrail.dev/init.sh | bash -s -- --all --languages python,bash --ci github --yes
3621
```
3722

38-
Supported languages: `python`, `bash`, `terraform`, `ansible`, `ruby`, `go`, `javascript`. List only the languages your project actually uses.
23+
This generates all DevRail files including the Makefile, `.devrail.yml`, pre-commit config, agent instruction files, CI workflows, and documentation. See the [CLI Reference](/docs/getting-started/cli-reference/) for all options.
3924

40-
### Step 3: Install Pre-Commit Hooks
25+
After running `devrail init`:
4126

4227
```bash
4328
# Install git hooks for local enforcement
4429
make install-hooks
45-
```
4630

47-
This sets up pre-commit hooks that run formatting checks and secret detection on every commit, plus a pre-push hook that runs `make check` before every push.
48-
49-
### Step 4: Run Your First Check
50-
51-
```bash
5231
# Run all DevRail checks
5332
make check
33+
34+
# Make your first commit
35+
git add .
36+
git commit -m "feat: initialize project with DevRail standards"
5437
```
5538

56-
The first run pulls the dev-toolchain Docker image (~1 GB). Subsequent runs use the cached image and complete in under 5 minutes.
39+
## Alternative: From a Template
5740

58-
### Step 5: Make Your First Commit
41+
You can also create a repository directly from one of the official templates. All DevRail configuration files are included and pre-configured.
5942

60-
```bash
61-
# Stage all files
62-
git add .
43+
### From GitHub Template
6344

64-
# Commit using conventional commit format
65-
git commit -m "feat: initialize project with DevRail standards"
66-
```
45+
Navigate to the [DevRail GitHub template](https://github.com/devrail-dev/github-repo-template) and click **"Use this template"** to create a new repository in your organization or personal account.
6746

68-
The pre-commit hooks run automatically. If any check fails, fix the issue and commit again.
47+
Alternatively, use the GitHub CLI:
6948

70-
## From GitLab Template
49+
```bash
50+
# Create a new repository from the DevRail GitHub template
51+
gh repo create my-new-project --template devrail-dev/github-repo-template --public
52+
cd my-new-project
53+
```
7154

72-
### Step 1: Create the Project
55+
### From GitLab Template
7356

7457
In GitLab, navigate to **New Project > Create from template > Custom** and select the DevRail GitLab template. Enter your project name and create the project.
7558

@@ -87,23 +70,38 @@ git add .
8770
git commit -m "feat: initialize project with DevRail standards"
8871
```
8972

90-
### Step 2: Configure Your Languages
91-
92-
Edit `.devrail.yml` just as described in the GitHub workflow above. The configuration file format is identical across platforms.
93-
94-
### Step 3: Install Pre-Commit Hooks and Verify
73+
### After Creating from Template
9574

9675
```bash
76+
# Edit .devrail.yml to declare your project's languages
77+
# Configure your languages (see below)
78+
9779
# Install git hooks
9880
make install-hooks
9981

10082
# Run all DevRail checks
10183
make check
10284
```
10385

104-
## What Is Included in the Template
86+
## Configure Your Languages
87+
88+
Edit `.devrail.yml` to declare which languages your project uses. The Makefile reads this file to determine which tools to run.
89+
90+
```yaml
91+
# .devrail.yml -- declare your project's languages
92+
languages:
93+
- python
94+
- bash
95+
96+
fail_fast: false
97+
log_format: json
98+
```
99+
100+
Supported languages: `python`, `bash`, `terraform`, `ansible`, `ruby`, `go`, `javascript`, `rust`. List only the languages your project actually uses.
101+
102+
## What Is Included
105103

106-
Both templates ship with the following files:
104+
Whether you use `devrail init` or a template, you get the following files:
107105

108106
| File | Purpose |
109107
|---|---|

0 commit comments

Comments
 (0)