Moose CLI
Moose CLI is a lightweight, globally installable tool that surfaces metadata about the Moose ecosystem and proxies common workflows (e.g., bootstrapping Moose starter templates via manifests) in an AI-friendly manner.
Install
# Verify Flutter is on PATH (required because the CLI bootstraps Flutter projects)
# macOS/Linux:
flutter --version >/dev/null 2>&1
# Windows (PowerShell):
flutter --version > $null 2>&1
# If the command above fails, install Flutter first: https://docs.flutter.dev/get-started/install
dart pub global activate moose_cli
Once activated you can run the CLI from anywhere. The snippet below walks through the most common flows:
# Print the installed version
moose version
# Scaffold an empty Flutter project (no manifest needed)
moose init my_app
# Bootstrap from a named built-in template
moose init my_app --template shopify
# Bootstrap a Moose starter project using a manifest on disk
moose init my_app --manifest ./starter_manifest.json
# Or point to a remote manifest (GitHub raw, CDN, etc.)
moose init my_app --manifest https://raw.githubusercontent.com/greymooseinc/moose_templates/refs/heads/main/shopify.json
What happens during moose init?
# verbose mode streams git output as repositories are cloned
moose init storefront --manifest ./manifests/shopify.json --verbose
- Manifest download – reads
shopify.jsonfrom disk or an HTTPS URL. - Base repo clone – clones the
base.repositoryintostorefront, strips.git, and prepares the project. - Extensions clone – pulls the
extensions.repository, copies the requested plugins/adapters intolib/pluginsandlib/adapters, and merges any dependency overrides. - Registration – updates
lib/main.dartby addingimportstatements and appending adapter/plugin entries toMooseBootstrapper.run(adapters: [...], plugins: [...])using classes from each module’smoose.manifest.json. - Configuration – writes plugin/adapter
configblocks intoassets/config/environment.json. - Localization merge – copies plugin ARB keys from
lib/plugins/<name>/l10n/*.arbinto all existing app ARB locale files (for examplelib/l10n/app_en.arb,app_fr.arb,app_si.arb) without overwriting existing keys. If a plugin is missing a locale, the CLI falls back to template locale keys (typically English), then runsflutter gen-l10n. - Dependencies – merges module dependencies into
pubspec.yamland runsdart pub get.
When init finishes you’ll see a cd <project> hint, so you can immediately start building inside the new workspace.
Commands
| Command | Description |
|---|---|
moose init <name> |
Scaffolds an empty Flutter project. |
moose init <name> --template <name> [--configurations <path=value>]... |
Scaffolds from a named built-in template; optionally pre-fills environment.json fields. |
moose init <name> --manifest <path|url> [--configurations <path=value>]... |
Copies the manifest-defined template; optionally pre-fills environment.json fields. |
moose plugin add <name> (--git repo | --path dir) [--configurations <path=value>]... |
Installs a plugin into lib/plugins/<name>, registers it in main.dart, and merges plugin l10n keys into app ARB files; aborts if already installed. |
moose adapter add <name> (--git repo | --path dir) [--configurations <path=value>]... |
Installs an adapter into lib/adapters/<name>; aborts if already installed. |
moose locale add <localeCode> |
Creates a new app ARB locale file by copying the template ARB (app_en.arb by default), validates the locale code, and runs flutter gen-l10n. |
moose version |
Prints the currently installed CLI version. |
moose help <command> |
Prints detailed usage (flags, subcommands) for the selected command. |
# Add a plugin from a remote extensions repo
moose plugin add loyalty --git https://github.com/greymooseinc/moose_extensions.git
# Add an adapter from a local extensions checkout
moose adapter add stripe --path ./extensions/lib/adapters
# Add Sinhala localization scaffold from app_en.arb
moose locale add si
Non-interactive / CI mode with --configurations
All three scaffolding commands (init, plugin add, adapter add) accept a --configurations (-c) flag for
supplying environment.json values on the command line. This lets you scaffold projects in CI pipelines or any
automated context without answering interactive prompts.
Values use a dotted-path key=value format that mirrors the structure of environment.json:
plugins.<moduleName>.<field>=<value>
adapters.<moduleName>.<field>=<value>
The flag can be repeated, or multiple pairs can be passed as separate arguments:
# Init with pre-filled plugin configuration — no prompts shown
moose init my_app --template shopify \
--configurations plugins.loyalty.apiKey=abc123 \
--configurations "plugins.loyalty.storeName=My Shop"
# Plugin add with pre-filled config
moose plugin add loyalty \
--configurations plugins.loyalty.apiKey=abc123
# Adapter add with pre-filled config
moose adapter add stripe \
--configurations adapters.stripe.secretKey=sk_test_xxx \
--configurations adapters.stripe.webhookSecret=whsec_yyy
Behaviour:
- If a supplied path matches a
$REPLACE_THIS$placeholder in the scaffolded config, the value is written automatically and the interactive prompt for that field is suppressed. - If a supplied path does not exist in the scaffolded config, it is created (intermediate maps are added as needed).
- Any placeholders not covered by
--configurationsare still prompted interactively as usual.
Tips:
- Use
--template <name>for built-in templates; use--manifestfor a local file or custom URL. They are mutually exclusive.- Templates are defined by manifest JSON files. Use
--manifestto point to those manifests, either on disk or via an HTTPS URL.- Command output is color-coded with emoji markers so you can follow progress at a glance.
- Use
moose plugin addormoose adapter addto pull individual modules without re-runninginit.- If you omit
--gitwhen runningmoose plugin|adapter add, the CLI defaults tohttps://github.com/greymooseinc/moose_extensions.git.- Running
moose plugin addormoose adapter addon a module that is already installed prints a warning and exits — remove the directory first if you want to reinstall.moose locale add <code>accepts ISO 639-1 language codes (optionally with a region likept-BR) and creates locale ARB files from your template ARB.- The manifest must specify the base repository and optional extensions repository; git must be installed and available on PATH.
- When plugins or adapters are present in the manifest,
lib/main.dartis automatically updated to import and register them.- Plugin/adapter configs defined in manifests are merged into
assets/config/environment.jsonunder their respective sections.- Each plugin can ship its own
moose.manifest.jsondescribing required imports and dependencies. These dependencies are merged into your project’spubspec.yamlbeforedart pub getruns.dart pub getruns automatically after cloning the template and installing extensions so dependencies stay in sync.
Development
dart test