Railstart Coder
Start
- Classify the task first: app generation, config setup, preset authoring, troubleshooting, or gem development.
- In an installed-user context, use
railstart .... - In this repo checkout, use
bundle exec exe/railstart ...for local CLI verification. - Do not run
railstart newunless the user actually wants an app generated. It creates directories and can run post-actions. - Read references/cli-and-config.md for command behavior, config layering, and current built-in defaults.
- Read references/presets-and-post-actions.md before adding or changing presets, custom choices, command actions, or template actions.
- Read references/gem-development.md before changing gem code or tests.
Choose the Right Layer
- Run
railstart initwhen the user needs a starting~/.config/railstart/tree. - Edit
~/.config/railstart/config.yamlfor personal defaults that should apply across runs. - Create a preset file for reusable named stacks or team conventions.
- Change
config/rails8_defaults.yamlonly when the gem's shipped behavior should change for everyone.
Common Workflows
Generate an App
- Decide whether the run should be interactive,
--default, or--preset NAME. - Use
railstart new APP_NAME ...for installed usage, orbundle exec exe/railstart new APP_NAME ...from this repo. - Remember
--defaultskips question prompts but still shows the summary and final confirmation. - Verify the selected preset and post-actions are appropriate before confirming generation.
Initialize or Customize Local Config
- Use
railstart initto create~/.config/railstart/config.yamland~/.config/railstart/presets/example.yaml. - Use
railstart init --forceonly when overwriting existing generated files is intended. - Keep user config overrides minimal; remove copied sections that are not being customized when writing a clean config by hand.
Create or Update a Preset
- Start from the smallest YAML override that changes only the intended defaults.
- Reuse built-in question ids whenever possible.
- Add new choices or post-actions only when the built-in model cannot represent the stack.
- Test both
--preset NAMEand--preset NAME --defaultwhen the preset is meant for repeatable non-interactive runs.
Troubleshoot a Railstart Run
- Check which config layers are active: built-in defaults, user config, and optional preset.
- Validate that question and post-action ids are unique after merging.
- Check
depends_onand post-actionifconditions against stored answer values, not display names. - For unexpected Rails flags, inspect
CommandBuilderand the selected question/choicerails_flagorrails_flags. - For post-action failures, distinguish app generation failure from post-action warnings; post-action failures continue by design.
Extend the Gem
- Inspect
lib/railstart/config.rb,lib/railstart/generator.rb,lib/railstart/command_builder.rb, andlib/railstart/template_runner.rbbefore adding logic. - Keep behavior declarative in config when possible instead of hardcoding one-off branches in the generator.
- Add or update tests with the change.
- Run the relevant test and lint commands from references/gem-development.md.
Rules
- Treat
--defaultas "load thedefaultpreset and skip interactive questions", not "use raw built-in config as-is". - Merge
questionsandpost_actionsbyid; do not copy entire arrays unless full replacement is intentional. - Use stable choice
values in stored answers andmulti_selectdefaults. - Remember presets can add new choices or post-actions that do not exist in the built-in config.
- Prefer
type: templatepost-actions when the work belongs in the Rails template DSL; keep simple shell steps as command actions. - When code and documentation disagree, trust the current implementation in
lib/andconfig/.