moinsen_cli 0.1.0 copy "moinsen_cli: ^0.1.0" to clipboard
moinsen_cli: ^0.1.0 copied to clipboard

Say moinsen to help you with your flutter projects

moinsen_cli #

[coverage] style: very good analysis License: MIT

Generated by the Very Good CLI πŸ€–

A powerful CLI tool to help you with your Flutter projects. Provides a gRPC server for executing commands with real-time feedback and interactive support.


Getting Started πŸš€ #

If the CLI application is available on pub, activate globally via:

dart pub global activate moinsen_cli

Or locally via:

dart pub global activate --source=path <path to this package>

Usage #

# Start the gRPC server (default port: 50051)
$ moinsen serve

# Start the gRPC server on a specific port
$ moinsen serve --port 50052

# Start the server with auto-generated secure access key
$ moinsen serve --secret

# Start the server with a specific secret key
$ moinsen serve --secret-key your_secret_key

# Start the server with command logging enabled
$ moinsen serve --log

# Update the CLI to the latest version
$ moinsen update

# Show CLI version
$ moinsen --version

# Show usage help
$ moinsen --help

Features #

  • gRPC command service with bidirectional streaming
  • Interactive command support with prompt detection
  • Secure server access with auto-generated or custom secret keys
  • Command logging with timestamps and execution details
  • Automatic CLI updates via pub.flutter-io.cn
  • Graceful server shutdown handling
  • Real-time command execution with detailed responses
  • Cross-platform support

Command Service Protocol #

The CLI provides a gRPC service for executing commands with the following features:

  • Bidirectional streaming for real-time command execution
  • Interactive command support (e.g., handling y/n prompts)
  • Response includes:
    • Command output
    • Current working directory
    • Timestamp
    • Interactive prompt detection
  • Error handling with stderr output

Protocol Messages #

message CommandRequest {
  string session_id = 1;
  string input_data = 2;
  bool is_interactive_answer = 3;
}

message CommandResponse {
  string session_id = 1;
  string output_data = 2;
  bool is_prompt = 3;
  int64 timestamp = 4;      // Unix timestamp in milliseconds
  string current_folder = 5; // Current working directory
}

Available Commands #

serve #

Starts the gRPC server for command execution.

Options:

  • --port, -p: Port to listen on (default: 50051)
  • --secret: Enable secure server access with an auto-generated secret key
  • --secret-key: Provide a specific secret key for server access
  • --log: Enable command logging to .moinsen-command-log.json

update #

Updates the CLI to the latest version from pub.flutter-io.cn.

Development #

Running Tests with Coverage πŸ§ͺ #

To run all unit tests use the following command:

$ dart pub global activate coverage 1.2.0
$ dart test --coverage=coverage
$ dart pub global run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info

To view the generated coverage report you can use lcov:

# Generate Coverage Report
$ genhtml coverage/lcov.info -o coverage/

# Open Coverage Report
$ open coverage/index.html

Generating Protocol Buffers #

To regenerate the gRPC code from protocol buffer definitions:

$ protoc --dart_out=grpc:lib/src/generated -Iprotos protos/command.proto

1
likes
130
points
17
downloads

Publisher

verified publishermoinsen.dev

Weekly Downloads

Say moinsen to help you with your flutter projects

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

args, cli_completion, fixnum, grpc, interact_cli, mason_logger, path, protobuf, pub_updater

More

Packages that depend on moinsen_cli