bootstrap
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWarp 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.
- MUST use AskUserQuestion - Do NOT generate the config until user selects their tabs
- MUST use - If
bin/devexists, use it. Do NOT parse Procfile.dev for individual commandsbin/dev - MUST use lowercase color names - Only valid: ,
red,green,yellow,blue,magentacyan - MUST use for commands - Format:
exec:NOT- exec: bin/dev- "bin/dev" - MUST use absolute paths - Never use or relative paths in
~fieldcwd - MUST start YAML with - The document separator is required
--- - MUST read reference docs - Before generating YAML, read @./references/launch-config-schema.md
请先阅读以下规则,违反规则会导致配置失效。
- 必须使用AskUserQuestion - 必须等待用户选择标签后再生成配置
- 必须使用- 如果存在
bin/dev,直接使用该命令,禁止解析Procfile.dev获取单独命令bin/dev - 必须使用小写颜色名称 - 仅支持以下有效值:,
red,green,yellow,blue,magentacyan - 必须为命令添加前缀 - 格式:
exec:而非- exec: bin/dev- "bin/dev" - 必须使用绝对路径 - 字段中禁止使用
cwd或相对路径~ - YAML文件必须以开头 - 必须包含文档分隔符
--- - 必须阅读参考文档 - 生成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
undefinedGet 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:
| Label | Description |
|---|---|
| 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}.yamlEXACT 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)
--- - MUST be lowercase:
color,green,blue,yellow,magenta,cyanred - MUST NOT be capitalized or an object with r/g/b values
color - MUST use
commandsprefix:exec:- exec: bin/dev - MUST NOT be plain strings like
commands- "bin/dev" - MUST be the absolute path from
cwdcommand (no quotes needed)pwd - MUST NOT use
cwdor 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,cyanred - 禁止使用首字母大写或RGB对象格式
color - 必须添加
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
常见错误规避
| Wrong | Right |
|---|---|
| |
| |
| |
| |
| |
Missing | Start file with |
| Parsing Procfile.dev for commands | Just use |
| Skipping AskUserQuestion | MUST ask and wait for response |
| 错误写法 | 正确写法 |
|---|---|
| |
| |
| |
| |
| |
文件开头缺少 | 文件开头添加 |
| 解析Procfile.dev获取命令 | 直接使用 |
| 跳过AskUserQuestion步骤 | 必须询问并等待用户回复 |
Reference Files
参考文件
- @./references/launch-config-schema.md - Launch configuration YAML format
- @./references/launch-config-schema.md - 启动配置YAML格式说明