Masamune logo

Katana CLI

Follow on GitHub Follow on X Follow on YouTube Maintained with Melos

GitHub Sponsor


[GitHub](https://github.com/mathrunet) | [YouTube](https://www.youtube.com/c/mathrunetchannel) | [Packages](https://pub.dev/publishers/mathru.net/packages) | [X](https://x.com/mathru) | [LinkedIn](https://www.linkedin.com/in/mathrunet/) | [mathru.net](https://mathru.net)


Command line interface used in the Masamune framework.

The following features are available

  • Project creation and optimization against the Masamune framework
  • Code template generation
  • Automatic code generation with build_runner
  • Other settings

Installation

Install with the following command.

flutter pub global activate katana_cli

Check the dependencies of the commands used internally. If these do not all pass, it may not work properly.

katana doctor

How to use

The following commands are available

katana [command] [subcommand] [optional parameters]

Help for the command is available at

katana help

Project Creation

Execute the following command in the folder where the project was created.

The Application ID should include the ID in the reverse domain (com.test.myapplication).

katana create [Application ID(e.g. com.test.myapplication)]

Code generation

The following commands can be used to generate each code template.

katana code [Code ID] [Optional Parameters]

Page

Create page templates under lib/pages.

katana code page [PageName]

Collection Model

Create a collection model under lib/models.

katana code collection [ModelName]

Document Model

Create a document model under lib/models.

katana code document [ModelName]

Controller

Create controllers under lib/controllers.

katana code controller [ControllerName]

For other codes, please see Help.

Masamune AI Debugger

Add the AI Debugger dependency, configure all flavor dart-defines, and register one adapter instance in a standard Masamune project.

katana code debuggable

Automatic code generation with build_runner

You must have build_runner installed in your project in order to run it.

flutter pub add --dev build_runner

Development and production environments

New projects use dart_defines/dev.env and dart_defines/prod.env. Run Flutter with --dart-define-from-file; Flutter's native --flavor option and the legacy katana flavor pre-copy workflow are not required.

flutter run --dart-define-from-file=dart_defines/dev.env
flutter build appbundle --dart-define-from-file=dart_defines/prod.env
katana apply --flavor dev
katana deploy --flavor prod

FLAVOR must be dev or prod. Android may optionally set ANDROID_APPLICATION_ID; otherwise Android, iOS, and macOS keep the common ID created by katana compose. Firebase configuration and Wrangler bindings are selected with the same FLAVOR. Worker endpoints remain explicit Dart adapter parameters and are never written to dart-defines.

Run katana apply --flavor dev and katana apply --flavor prod once for each environment. The order does not matter and reapplying one environment preserves the other environment. Cloudflare keeps both projects in one wrangler.jsonc under env.dev and env.prod. Firebase shares the deploy configuration in firebase/firebase.json and stores both project mappings as dev and prod aliases in firebase/.firebaserc. Katana commands also pass the resolved project or environment explicitly, so they do not depend on the Firebase default alias or Wrangler's top-level environment. Wrangler's top-level Worker name is kept fixed to the production/base project so applying dev does not rewrite it. When running Wrangler directly, always pass --env dev or --env prod; use katana deploy --flavor <flavor> for the guarded deployment flow.

Existing projects can be inspected without changes and migrated explicitly:

katana fix
katana fix --dry-run
katana fix --apply

Create Firebase and Cloudflare projects before running apply. Katana does not create those projects automatically.

Automatic code generation

If you want to perform automatic code generation as a one-shot, execute the following command.

katana code generate

Code generation monitoring

If you want to monitor code changes and automatically generate code when changes are made, execute the following command.

katana code watch

For other commands, please see Help.

GitHub Sponsors

Sponsors are always welcome. Thank you for your support!

https://github.com/sponsors/mathrunet

Libraries

action/ads/ads
action/agora/agora
action/ai/openai
action/app/animate
action/app/app_review
action/app/att
action/app/calendar
action/app/camera
action/app/csr
action/app/force_updater
action/app/geocoding
action/app/icon
action/app/info
action/app/introduction
action/app/keystore
action/app/local_notification
action/app/location
action/app/p12
action/app/picker
action/app/privacy_manifests
action/app/speech_to_text
action/app/spread_sheet
action/app/text_to_speech
action/cloudflare/authentication
action/cloudflare/cloudflare_source_utils
action/cloudflare/deploy
action/cloudflare/init
action/cloudflare/kv
action/cloudflare/storage
action/cloudflare/tidb
action/cloudflare/tidb_data_service_api
action/cloudflare/tidb_state
action/cloudflare/turso
action/ecosystem/ecosystem
action/firebase/algolia
action/firebase/authentication
action/firebase/deploy
action/firebase/firestore
action/firebase/init
action/firebase/messaging
action/firebase/scheduler
action/firebase/terms_and_privacy
action/firebase/workflow
action/git/action
action/git/hook
action/git/platform/android
action/git/platform/ios
action/git/platform/web
action/git/review
action/git/status_check
action/mail/send_grid
action/post/firebase_deploy_post_action
action/purchase/purchase
action/stripe/stripe
command/analytics/analytics
command/apply
command/cer/cer
command/code/code
command/code/server/server
command/code/test/test
command/code/view/view
command/create
command/deploy
command/doctor
command/fix
command/flavor/flavor
command/git/git
command/module
command/pub/pub
command/store/store
command/test/test
config
katana
katana_cli
Command line tool for Masamune/Katana Framework. It initializes the project and initializes the services.
localize
snippet/modals/confirmation
snippet/modals/modals
snippet/models/models
snippet/models/user
snippet/pages/logic/retrieve_user
snippet/pages/page/login
snippet/pages/pages
snippet/redirects/login
snippet/redirects/redirects
snippet/snippet
snippet/theme/form/auth_button
snippet/theme/theme