Skip to content

bl add

Add a snippet or stack to boiler/ by default

Add a stored snippet or stack to ./boiler by default.

Destination:

  • Use optional [destination] to override the default path.
  • bl add logger .
  • bl add logger ./src/utils
  • bl add logger /absolute/path

Stack placement:

  • By default, stacks are copied inside a stack-named folder.
  • bl add express@1 -> ./boiler/express
  • Use --spread to copy stack contents directly into destination.
  • bl add express@1 --spread -> contents in ./boiler

The command copies resources from your store. For snippets with a single version, you can use just the name (e.g., 'errorHandler' will auto-select version 1). For multiple versions, you'll be prompted to choose.

Template Variables:

  • Snippets can contain template variables using the format: bl__VAR_NAME.
  • When adding a snippet with variables, you'll be prompted to provide values.
  • If matching config vars exist, they are used as defaults.
  • Default values are shown in brackets (from __var declarations).
  • Press Enter to use default or type a custom value.
  • Variables are replaced and metadata comments are removed in the final file.

Command Variables:

  • Use :name to resolve values from config vars (set via 'bl var').
  • Example: bl add express@1 -r --registry :team_reg

Stacks are also versioned and can be added by name or with explicit version.

Remote Resources:

  • Use -r flag to fetch from remote source and save to local store.
  • Provider is auto-detected from the URL (GitHub, GitLab, Bitbucket, generic).
  • Resource is cached locally; subsequent uses do not need -r.
  • Use --no-store for one-shot fetch without saving to local store.
  • Use --stack/-k or --snippet/-n to override stack/snippet auto-detection.
  • For ambiguous remote inputs, stack detection is preferred by default.

Supported remote formats:

  • Registry: bl add express@1 -r (registry set via: bl conf --set-registry <url>)
  • GitHub short: bl add owner/repo -r
  • GitHub full URL: bl add https://github.com/owner/repo -r
  • GitLab: bl add https://gitlab.com/owner/repo -r
  • Bitbucket: bl add https://bitbucket.org/owner/repo -r
  • File from repo: bl add owner/repo:path/to/file.js -r
  • Direct file URL: bl add https://site.com/file.js -r
  • Direct archive: bl add https://site.com/stack.zip -r
  • Custom domain file: bl add site.com:path/file.js -r
  • One-time registry: bl add express@1 -r --registry https://github.com/other/boiler
bl add [resource] [destination] [flags]
# Add snippet (auto-detects if single version)
bl add errorHandler
# Add to current directory
bl add errorHandler .
# Add to a custom destination
bl add errorHandler ./src/utils
# Add snippet with template variables
bl add apiClient
# Prompts: bl__API_URL [http://localhost:3000]: https://api.example.com
# bl__API_KEY [your-key]: abc123xyz
# Output: Clean file with variables replaced, no metadata comments
# Add specific version
bl add logger@2.js
# Add stack into boiler/express-api
bl add express-api@1
# Add stack contents directly into destination
bl add express-api@1 --spread
# Force overwrite
bl add middleware --force
# Remote: from configured registry
bl add express@1 -r
# Remote: GitHub short format
bl add rishiyaduwanshi/boiler-express -r
# Remote: GitLab
bl add https://gitlab.com/alice/my-stack -r
# Remote: Bitbucket
bl add https://bitbucket.org/alice/my-stack -r
# Remote: file inside GitHub repo
bl add rishiyaduwanshi/boiler-snippets:js/errorHandler.js -r
# Remote: direct file URL
bl add https://mysite.com/snippets/helper.js -r
# Remote: direct archive URL
bl add https://mysite.com/stack.zip -r
# Remote: force snippet mode when auto-detection is unclear
bl add owner/repo:path/to/template -r --snippet
# Remote: force stack mode
bl add https://example.com/custom-source -r --stack
# Remote: one-time registry override
bl add express@1 -r --registry https://github.com/myorg/boiler
# Remote: registry from config variable
bl add express@1 -r --registry :team_reg
# One-shot fetch without saving to store
bl add alice/my-stack -r --no-store
-f, --force Force operation without confirmation
-h, --help help for add
--no-store Fetch remote resource without saving to local store
--registry string Custom registry URL (overrides config)
-r, --remote Fetch from remote registry
-n, --snippet Treat resource as snippet (overrides auto-detection)
--spread Spread stack contents directly into destination
-k, --stack Treat resource as stack (overrides auto-detection)
-V, --verbose Enable verbose debug output