bootstrap

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Warp Rails Bootstrap

Warp Rails 终端初始化配置

Configure Warp terminal for optimal Rails development with colored tabs.
为Rails开发优化Warp终端配置,添加彩色标签功能。

Critical Rules

核心规则

READ THESE FIRST. VIOLATIONS WILL BREAK THE CONFIG.
  1. MUST use AskUserQuestion - Do NOT generate the config until user selects their tabs
  2. MUST use
    bin/dev
    - If
    bin/dev
    exists, use it. Do NOT parse Procfile.dev for individual commands
  3. MUST use lowercase color names - Only valid:
    red
    ,
    green
    ,
    yellow
    ,
    blue
    ,
    magenta
    ,
    cyan
  4. MUST use
    exec:
    for commands
    - Format:
    - exec: bin/dev
    NOT
    - "bin/dev"
  5. MUST use absolute paths - Never use
    ~
    or relative paths in
    cwd
    field
  6. MUST start YAML with
    ---
    - The document separator is required
  7. MUST read reference docs - Before generating YAML, read @./references/launch-config-schema.md
请先阅读以下规则,违反规则会导致配置失效。
  1. 必须使用AskUserQuestion - 必须等待用户选择标签后再生成配置
  2. 必须使用
    bin/dev
    - 如果存在
    bin/dev
    ,直接使用该命令,禁止解析Procfile.dev获取单独命令
  3. 必须使用小写颜色名称 - 仅支持以下有效值:
    red
    ,
    green
    ,
    yellow
    ,
    blue
    ,
    magenta
    ,
    cyan
  4. 必须为命令添加
    exec:
    前缀
    - 格式:
    - exec: bin/dev
    而非
    - "bin/dev"
  5. 必须使用绝对路径 -
    cwd
    字段中禁止使用
    ~
    或相对路径
  6. YAML文件必须以
    ---
    开头
    - 必须包含文档分隔符
  7. 必须阅读参考文档 - 生成YAML前,请阅读@./references/launch-config-schema.md

Workflow

操作流程

Execute these steps IN ORDER. Do not skip steps.
请按以下顺序执行步骤,禁止跳过任何步骤。

Step 1: Verify Rails Project

步骤1:验证Rails项目

Run this command:
bash
test -f config/application.rb && echo "RAILS PROJECT" || echo "NOT RAILS"
If NOT RAILS, stop and tell user to run from a Rails directory.
运行以下命令:
bash
test -f config/application.rb && echo "RAILS PROJECT" || echo "NOT RAILS"
如果返回NOT RAILS,请停止操作并告知用户在Rails项目目录下执行。

Step 2: Gather Project Context

步骤2:收集项目上下文信息

Run these commands and store the results:
bash
undefined
运行以下命令并保存结果:
bash
undefined

Get absolute path (REQUIRED for cwd)

获取绝对路径(cwd字段必填)

pwd
pwd

Get project name from directory

从目录名称获取项目名称

basename "$(pwd)"
basename "$(pwd)"

Check for bin/dev

检查是否存在bin/dev

test -f bin/dev && echo "HAS_BIN_DEV=true" || echo "HAS_BIN_DEV=false"
test -f bin/dev && echo "HAS_BIN_DEV=true" || echo "HAS_BIN_DEV=false"

Check for background job processor

检查是否包含后台任务处理器

grep -l "sidekiq|good_job|solid_queue" Gemfile 2>/dev/null && echo "HAS_JOBS=true" || echo "HAS_JOBS=false"

**IMPORTANT:**
- If `HAS_BIN_DEV=true`, the dev command is `bin/dev`. Period. Do NOT look inside Procfile.dev.
- If `HAS_BIN_DEV=false`, the dev command is `bin/rails server`.
grep -l "sidekiq|good_job|solid_queue" Gemfile 2>/dev/null && echo "HAS_JOBS=true" || echo "HAS_JOBS=false"

**重要提示:**
- 如果`HAS_BIN_DEV=true`,开发命令固定为`bin/dev`,禁止查看Procfile.dev内容。
- 如果`HAS_BIN_DEV=false`,开发命令为`bin/rails server`。

Step 3: STOP - Ask Tab Configuration

步骤3:暂停 - 询问标签配置

You MUST use AskUserQuestion here. Do NOT proceed until user responds.
Ask: "Which tabs do you want in your Warp launch configuration?"
Use multi-select with these options:
LabelDescription
Server (green)Run dev server (bin/dev or rails server)
Claude (blue)Start Claude Code session
Shell (yellow)Empty terminal for commands
Console (magenta)Rails console
Logs (cyan)Tail log/development.log
If HAS_JOBS=true, also include: | Jobs (red) | Background job processor |
WAIT FOR USER RESPONSE BEFORE CONTINUING.
此处必须使用AskUserQuestion,等待用户回复后再继续。
询问用户:“你希望在Warp启动配置中添加哪些标签?”
提供以下多选选项:
标签描述
Server (绿色)运行开发服务器(bin/dev 或 rails server)
Claude (蓝色)启动Claude代码会话
Shell (黄色)用于执行命令的空终端
Console (品红色)Rails控制台
Logs (青色)实时查看log/development.log日志
如果HAS_JOBS=true,额外添加选项: | Jobs (红色) | 后台任务处理器 |
等待用户回复后再继续。

Step 4: Read Reference Documentation

步骤4:阅读参考文档

Before writing ANY YAML, read the schema reference:
Read @./references/launch-config-schema.md
This ensures you use the correct format.
在编写任何YAML前,请阅读格式参考文档:
阅读@./references/launch-config-schema.md
这将确保你使用正确的格式。

Step 5: Generate Launch Configuration

步骤5:生成启动配置

Create the launch configuration file.
File location:
~/.warp/launch_configurations/{project-name}.yaml
EXACT FORMAT TO USE:
yaml
---
name: {project-name}
windows:
  - tabs:
      - title: Server
        color: green
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
          commands:
            - exec: bin/dev
      - title: Claude
        color: blue
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
          commands:
            - exec: claude
      - title: Shell
        color: yellow
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
FORMAT RULES:
  • File MUST start with
    ---
    (YAML document separator)
  • color
    MUST be lowercase:
    green
    ,
    blue
    ,
    yellow
    ,
    magenta
    ,
    cyan
    ,
    red
  • color
    MUST NOT be capitalized or an object with r/g/b values
  • commands
    MUST use
    exec:
    prefix:
    - exec: bin/dev
  • commands
    MUST NOT be plain strings like
    - "bin/dev"
  • cwd
    MUST be the absolute path from
    pwd
    command (no quotes needed)
  • cwd
    MUST NOT use
    ~
    or relative paths
创建启动配置文件。
文件路径:
~/.warp/launch_configurations/{project-name}.yaml
必须使用的格式:
yaml
---
name: {project-name}
windows:
  - tabs:
      - title: Server
        color: green
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
          commands:
            - exec: bin/dev
      - title: Claude
        color: blue
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
          commands:
            - exec: claude
      - title: Shell
        color: yellow
        layout:
          cwd: {ABSOLUTE_PATH_FROM_PWD}
格式规则:
  • 文件必须以
    ---
    开头(YAML文档分隔符)
  • color
    必须为小写:
    green
    ,
    blue
    ,
    yellow
    ,
    magenta
    ,
    cyan
    ,
    red
  • color
    禁止使用首字母大写或RGB对象格式
  • commands
    必须添加
    exec:
    前缀:
    - exec: bin/dev
  • commands
    禁止使用纯字符串格式如
    - "bin/dev"
  • cwd
    必须为
    pwd
    命令返回的绝对路径(无需加引号)
  • cwd
    禁止使用
    ~
    或相对路径

Step 6: Display Summary

步骤6:显示配置摘要

Show the user what was created:
Warp launch configuration created for {project-name}!

Location: ~/.warp/launch_configurations/{project-name}.yaml

How to use:
  Keyboard:     Ctrl-Cmd-L → select "{project-name}"
  Direct URL:   warp://launch/{project-name}.yaml

Tabs configured:
  {list each tab with color and command}
向用户展示已创建的配置:
已为{project-name}创建Warp启动配置!

文件路径: ~/.warp/launch_configurations/{project-name}.yaml

使用方法:
  快捷键:     Ctrl-Cmd-L → 选择"{project-name}"
  直接链接:   warp://launch/{project-name}.yaml

已配置的标签:
  {列出每个标签的颜色和对应命令}

Common Mistakes to Avoid

常见错误规避

WrongRight
color: Green
color: green
color: { r: 34, g: 197, b: 94 }
color: green
commands: ["bin/dev"]
commands: [- exec: bin/dev]
cwd: ~/project
cwd: /Users/avi/project
cwd: .
cwd: /Users/avi/project
Missing
---
at start
Start file with
---
Parsing Procfile.dev for commandsJust use
bin/dev
Skipping AskUserQuestionMUST ask and wait for response
错误写法正确写法
color: Green
color: green
color: { r: 34, g: 197, b: 94 }
color: green
commands: ["bin/dev"]
commands: [- exec: bin/dev]
cwd: ~/project
cwd: /Users/avi/project
cwd: .
cwd: /Users/avi/project
文件开头缺少
---
文件开头添加
---
解析Procfile.dev获取命令直接使用
bin/dev
跳过AskUserQuestion步骤必须询问并等待用户回复

Reference Files

参考文件

  • @./references/launch-config-schema.md - Launch configuration YAML format
  • @./references/launch-config-schema.md - 启动配置YAML格式说明