feat(init): add template system for project-type-aware setup#17
Merged
MrFlounder merged 1 commit intomainfrom Feb 5, 2026
Merged
feat(init): add template system for project-type-aware setup#17MrFlounder merged 1 commit intomainfrom
MrFlounder merged 1 commit intomainfrom
Conversation
Add a template system to `crab init` that auto-detects project type and applies pre-built configurations. Includes a promptfoo-cloud template with port_spacing, install_env, admin-app/.env, and API_PORT/PORT refs. New flags: --template/-t <name>, --list-templates. The `pf` alias maps to promptfoo-cloud. Also updates Slack token config to prefer the CRAB_SLACK_BOT_TOKEN env var over config file. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
crab initpreviously generated a minimal config and relied oncrab config scanto detect ports after the fact. For known project types like promptfoo-cloud, this left users with an incomplete config missing critical fields (port_spacing,install_env,admin-app/.env,API_PORT/PORTrefs) -- the same gaps identified in PR #3185.What
template_promptfoo_cloud(),detect_template(),apply_template(),show_templates()show_init()to support:--template <name>/-t <name>flag (withpfalias forpromptfoo-cloud)--list-templatesflag.gitmodulesfor promptfoo submodule +server/.env.example)show_init "${@:2}"CRAB_SLACK_BOT_TOKENenv var over config file entryThe promptfoo-cloud template includes:
port_spacing: 10install_env: PROMPTFOO_NODE_MODULES_CACHED=trueadmin-app/.envinenv_sync.filesAPI_PORTandPORTrefs in env syncHow to Test
crab init --list-templates-- should display the promptfoo-cloud templatecrab init -t promptfoo-cloud-- should apply the template and generate a full configcrab init -t pf-- alias should also workcrab init-- should auto-detect and offer to apply the templatecrab initin a non-matching repo -- should fall through to the minimal 2-question setup