Documentation languages

RGB Mobile Custom CLI Commands.

// To install:
pub global activate rgb_cli 
// (to use this add the following to system PATH: [FlutterSDKInstallDir]\bin\cache\dart-sdk\bin

flutter pub global activate rgb_cli

// To create a page (module-aware):
// Pages generate: views, view_model, bindings and register routes.
// Usage with module flag:
rgb create page:login -m auth

// Without -m defaults to module "general":
rgb create page:home

// To create a new view model in a specific folder:
// Long form:
rgb create view_model:view_model_name on home
// Alias:
rgb create -vm:view_model_name on home

// To create a domain usecase (interface + implementation):
// Generates: lib/domain/usecase/<name>/{<name>_interface.dart,<name>_use_case.dart,<name>.dart}
// Also creates/updates lib/domain/domain.dart with exports
rgb create -u address
// or long form
rgb create use_case:address

// To run the app with environment:
rgb run -dev              // Run in development environment
rgb run -staging          // Run in staging environment
rgb run -uat              // Run in UAT environment
rgb run -production       // Run in production environment
rgb run -dev on emulator-5554  // Run on specific device

// To build the app:
rgb build -a -dev         // Build Android APK (Development)
rgb build -a -staging     // Build Android APK (Staging)
rgb build -a -uat         // Build Android APK (UAT)
rgb build -a -production  // Build Android APK (Production)
rgb build -i -staging     // Build iOS IPA (Staging)
rgb build -aab            // Build Android App Bundle (Production only)
// Options: -android (-a), -ios(-i)
// Environments: -dev (-d), -staging (-s), -uat (-u), -production (-p), -aab

// To generate a class model:
// Note: 'assets/models/user.json' path of your template file in json format
// Note: on  == folder output file
// Getx will automatically search for the home folder
// and insert your class model there.
rgb generate model on home with assets/models/user.json

//Note: the URL must return a json format
rgb generate model on home from "https://api.github.com/users/ibnu009"

// To setup deeplinks for Android and iOS:
rgb deeplink
// Generates Android manifest intent-filter, productFlavors with deeplink placeholders,
// .well-known/assetlinks.json, .well-known/apple-app-site-association, and sha256_instruction.md

// To organize existing folders with export files:
rgb organize                    // Organize all (presentation + domain)
rgb organize home               // Organize specific page
rgb organize home profile       // Organize multiple pages
rgb organize -u auth            // Organize specific usecase
rgb organize -p                 // Organize all presentation pages
rgb organize -d                 // Organize all domain usecases
rgb organize --dry-run          // Preview changes without applying
rgb organize -v                 // Verbose output
// Creates export files in folders and updates top-level exports

// To generate a README.md template with rgb CLI commands:
rgb readme
// Generates a complete README.md with project structure and rgb CLI usage examples

// To install a package in your project (dependencies):
rgb install camera

// To install several packages from your project:
rgb install http path camera

// To install a package with specific version:
rgb install path:1.6.4

// To install a dev package in your project (dependencies_dev):
rgb install flutter_launcher_icons --dev

// To remove a package from your project:
rgb remove http

// To remove several packages from your project:
rgb remove http path

// To update CLI:
rgb update
// or `rgb upgrade`

// Shows the current CLI version:
rgb -v
// or `rgb -version`

// For help
rgb help

CLI Details

Below is the list of outputs each command generates, based on current implementation:

  • create page:

    • Generates Use Case under domain:
      • lib/domain/use_case/<name>/<name>_interface.dart
      • lib/domain/use_case/<name>/<name>_use_case.dart
      • lib/domain/use_case/<name>/<name>.dart (exports interface + use_case)
    • Generates Presentation layer under the selected module (default module: general):
      • lib/presentation/<module>/<name>/view_model/<name>_view_model.dart
      • lib/presentation/<module>/<name>/view_model/view_model.dart (exports all view_models)
      • lib/presentation/<module>/<name>/views/<name>_view.dart
      • lib/presentation/<module>/<name>/views/views.dart (exports all views)
      • lib/presentation/<module>/<name>/bindings/<name>_binding.dart
      • lib/presentation/<module>/<name>/bindings/bindings.dart (exports all bindings)
      • lib/presentation/<module>/<name>/<name>.dart (exports all folder-level exports)
    • Updates lib/domain/domain.dart with usecase export
    • Updates lib/presentation/presentation.dart with page export
    • Registers a new route in the app routes (AppPages).
  • create view_model: (alias: -vm or vm)

    • Creates a ViewModel file using the ViewModel template.
    • Output folder is derived from the on target; current implementation writes under the module's controllers/ directory.
    • If a Binding exists for the module/page, adds the dependency to it automatically.
  • create use_case: (alias: -u, uc)

    • Creates domain layer artifacts:
      • lib/domain/use_case/<name>/<name>_interface.dart
      • lib/domain/use_case/<name>/<name>_use_case.dart
      • lib/domain/use_case/<name>/<name>.dart (exports interface + use_case)
    • Updates lib/domain/domain.dart with usecase export
  • generate model on (or: from "<url>")

    • Creates a Dart model file from JSON:
      • <target_path>/<name>_model.dart
    • Unless --skipProvider is passed, also generates a Provider with basic endpoints:
      • <target_path>/providers/<name>_provider.dart
  • run -d/-s/-u/-p on <deviceId>

    • Runs Flutter app with automatic environment detection and dart-defines injection
    • Finds corresponding .env file (dev/.env, staging/.env, uat/.env, production/.env)
    • Automatically adds all env variables as --dart-define arguments
    • Sets --flavor and --target based on selected environment
    • Examples: rgb run -dev | rgb run -staging on emulator-5554 | rgb run -production
    • Auto-detects environment if no flag provided (priority: dev → staging → uat → production)
  • build -a/-i -d/-s/-u/-p or -aab

    • Build app using build-app.sh script with automatic artifact management
    • Moves built APK/IPA/AAB to flutter_build/ folder with naming: {name}-{env}-{version}+{buildNumber}.{ext}
    • Supports custom_name from pubspec.yaml
    • Options: -android (-a), -ios (-i)
    • Envs: -dev (-d), -staging (-s), -uat (-u), -production (-p), -aab (production only)
    • Examples: rgb build -a -dev | rgb build -i -staging | rgb build -aab
  • deeplink

    • Automates Android and iOS deeplink setup
    • Prompts for autogenerate (with staging/production links) or placeholder mode
    • Android: Updates AndroidManifest.xml with intent-filter, upserts productFlavors with manifestPlaceholders
    • Generates .well-known/assetlinks.json with package info and SHA256 placeholder
    • Generates .well-known/apple-app-site-association (AASA) for iOS Universal Links
    • Creates sha256_instruction.md with certificate generation steps
    • Example: rgb deeplink
  • organize folder_name... -p/-d/-u --dry-run -v

    • Retroactively applies export file structure to existing folders
    • Creates missing export files in each folder (bindings/bindings.dart, view_model/view_model.dart, views/views.dart)
    • Creates root export files for each feature
    • Updates lib/presentation/presentation.dart and lib/domain/domain.dart
    • Options:
      • No args: Organize all (presentation + domain)
      • folder_name: Organize specific page(s) by name
      • -u folder_name: Organize specific usecase(s) by name
      • -p or --presentation: Organize all presentation pages
      • -d or --domain: Organize all domain usecases
      • --dry-run: Preview changes without applying
      • -v or --verbose: Show detailed output
    • Examples: rgb organize home | rgb organize -u auth | rgb organize -p | rgb organize --dry-run
  • readme

    • Generates a complete README.md template with rgb CLI commands
    • Auto-detects project name from pubspec.yaml
    • Prompts for project description
    • Includes: Architecture, Prerequisites, Installation, Configuration, Usage (with rgb commands), Testing, Project Structure, Contributing, License
    • Example: rgb readme
  • init

    • Creates a minimal lib/main.dart for GetX pattern.
    • Installs Get and scaffolds an initial page (invokes create page).
    • Creates initial lib/ structure and module directories.
  • install

    • Adds dependencies (or dev_dependencies with --dev) to pubspec.yaml and runs flutter pub get.
  • remove

    • Removes dependencies from pubspec.yaml and runs flutter pub get.
  • sort --relative --skipRename

    • Sorts and formats imports across project files; optionally uses relative imports and can skip renaming based on separator rules.
  • update / upgrade

    • Updates this CLI to the latest version.
  • -v / --version

    • Shows the current CLI version.
  • help

    • Lists available commands with brief hints.

Libraries

cli_config/cli_config
commands/commands_list
commands/impl/args_mixin
commands/impl/build
commands/impl/commads_export
commands/impl/create/page/page
commands/impl/create/project/project
commands/impl/create/provider/provider
commands/impl/create/screen/screen
commands/impl/create/usecase/usecase
commands/impl/create/view/view
commands/impl/create/view_model/view_model
commands/impl/generate/locales/locales
commands/impl/generate/model/model
commands/impl/help/help
commands/impl/init/flutter/init
commands/impl/init/flutter/init_getxpattern
commands/impl/install/install
commands/impl/install/install_get
commands/impl/launch/launch
commands/impl/organize/organize
commands/impl/readme/readme
commands/impl/remove/remove
commands/impl/run/run
commands/impl/sort/sort
commands/impl/update/update
commands/impl/version/version
commands/interface/command
common/utils/backup/backup_utils
common/utils/json_serialize/helpers
common/utils/json_serialize/json_ast/error
common/utils/json_serialize/json_ast/json_ast
common/utils/json_serialize/json_ast/location
common/utils/json_serialize/json_ast/parse
common/utils/json_serialize/json_ast/parse_error_types
common/utils/json_serialize/json_ast/tokenize
common/utils/json_serialize/json_ast/tokenize_error_types
common/utils/json_serialize/json_ast/utils/grapheme_splitter
common/utils/json_serialize/json_ast/utils/substring
common/utils/json_serialize/model_generator
common/utils/json_serialize/sintaxe
common/utils/logger/log_utils
common/utils/pub_dev/pub_dev_api
common/utils/pubspec/pubspec_lock
common/utils/pubspec/pubspec_utils
common/utils/pubspec/yaml_to.string
common/utils/shell/shel.utils
core/generator
core/internationalization
core/locales.g
core/structure
exception_handler/exception_handler
exception_handler/exceptions/cli_exception
extensions
extensions/dart_code
extensions/list
extensions/string
functions/binding/add_dependencies
functions/binding/find_bindings
functions/create/create_list_directory
functions/create/create_main
functions/create/create_navigation
functions/create/create_single_file
functions/create/create_web
functions/exports_files/add_export
functions/find_file/find_file_by_name
functions/find_file/find_folder_by_directory
functions/formatter_dart_file/frommatter_dart_file
functions/is_url/is_url
functions/path/replace_to_relative
functions/replace_vars/replace_vars
functions/routes/arc_add_route
functions/routes/get_add_route
functions/routes/get_app_pages
functions/routes/get_support_children
functions/sorter_imports/sort
functions/version/check_dev_version
functions/version/version_update
models/file_model
rgb_cli
samples/impl/analysis_options
samples/impl/generate_locales
samples/impl/get_app_pages
samples/impl/get_binding
samples/impl/get_provider
samples/impl/get_route
samples/impl/get_usecase
samples/impl/get_view
samples/impl/get_view_model
samples/impl/getx_pattern/get_main
samples/interface/sample_interface