moonbitstack/moonctl/cli does not have a README file

    Command

    pub(all) struct Command {
    name : String
    usage : String
    summary : String
    }

    One command: what it is called, the line that shows how to call it, and one sentence saying what it does.

    Config

    pub(all) struct Config {
    version : Int
    home : String
    remote : String
    branch : String
    style : String
    templates : Array[String]
    }

    One configuration: the fields mctl understands. version is the file format, not the mctl version, and it goes up when migrate_config learns a new shape.

    Library

    pub(all) struct Library {
    home : String
    remote : String
    branch : String
    }

    The template library a run reads from. Empty home and remote mean the bundled library — the scaffolds in code; --home names a directory laid out like it, --remote a git repository to check out at branch.

    Serve

    pub(all) struct Serve {
    pkg : String
    reload : Bool
    dirs : Array[String]
    delay : Int
    args : Array[String]
    }

    What mctl serve was asked to do: the package to build and run, whether to rebuild it on change, where and how often to look, and the arguments that go to the server.

    TemplateEntry

    pub(all) struct TemplateEntry {
    name : String
    kind : String
    description : String
    path : String
    }

    One template: the name a user types, the kind of spec it reads, one sentence on what it produces, and the directory under the template home it lives in.

    bug_report

    fn bug_report(title : String, version : String, rows : Array[(String, String)]) -> String

    mctl bug: a report with the environment filled in and the questions a maintainer would otherwise have to ask. title may be empty, in which case the report asks for one.

    built_binary

    fn built_binary(output : String) -> String?

    The executable a moon run --build-only built, from what it prints.

    command_names

    fn command_names() -> Array[String]

    The words a shell should complete at the first position.

    commands

    fn commands() -> Array[Command]

    Every command mctl accepts, in the order help prints them: the generators, the scaffolds, the spec tools, then the housekeeping.

    completion

    fn completion(shell : String) -> String

    A shell completion script for shell, or "" for a shell mctl has none for. Completion is generated from commands and subcommands, so a new command is completable the moment it is in the table.

    config_get

    fn config_get(c : Config, key : String) -> String?

    The value of one key, or None when mctl has no such key.

    config_keys

    fn config_keys() -> Array[String]

    The keys config get and config set accept.

    config_set

    fn config_set(c : Config, key : String, value : String) -> Config

    c with one key set. template appends — a config may name several — while a scalar key replaces what was there. An unknown key is returned unchanged, so a caller checks the key against config_keys first.

    config_text

    fn config_text(c : Config) -> String

    The configuration as the file it is stored in, with a comment saying what the file is for and where the keys come from.

    default_branch

    let default_branch : String

    The branch --remote reads when --branch names none.

    default_config

    fn default_config() -> Config

    The file mctl writes when there is none yet: the bundled library, the default branch, the gozero spelling.

    env_report

    fn env_report(version : String, rows : Array[(String, String)]) -> String

    mctl env: one line per setting, then a hint at what to change. rows pairs a setting with its value and, in parentheses, where it came from.

    export_kinds

    fn export_kinds() -> Array[String]

    The kinds mctl template export writes a starting spec for — one per generator, named the way the command is spelled.

    export_sample

    fn export_sample(kind : String) -> Array[(String, String)]?

    The spec to start from for kind, as (path, contents) pairs — one file for most kinds, and a proto plus its route map for the gateway. None for a kind this command does not write.

    The file is named for the kind rather than the service, so two kinds exported into one directory do not overwrite each other, and api-sample.api says what it is when it turns up in a repository a year from now.

    find_template

    fn find_template(name : String) -> TemplateEntry?

    The template called name, or None.

    is_bundled

    fn is_bundled(lib : Library) -> Bool

    Whether this is the bundled library, which is code rather than files.

    is_skipped

    fn is_skipped(dir : String) -> Bool

    Whether a directory is left out of the walk: what the build itself writes, and anything hidden.

    is_watched

    fn is_watched(name : String) -> Bool

    Whether a save to this file calls for a rebuild: MoonBit source, or the manifests that say how it is built.

    library

    fn library(home? : String, remote? : String, branch? : String) -> Library

    The library the three flags describe. --home wins over --remote when both are given: a local directory is already checked out.

    migrate_config

    fn migrate_config(text : String) -> (String, Array[String])

    A v1 configuration — the uppercase, environment-style keys mctl read before it had a file — rewritten as the current shape. Returns the new text and one line per key that changed, so mctl config migrate can say what it did.

    mod_pins

    fn mod_pins(mod : String) -> Array[(String, String)]

    The version strings of mod, as (name, version) pairs: every pin the file carries, in order.

    parse_config

    fn parse_config(text : String) -> Config

    Read a configuration. A key mctl does not know is kept out of the result rather than refused, so a file written by a newer mctl still loads. An empty or unreadable-text file is the default configuration.

    parse_serve

    fn parse_serve(argv : ArrayView[String]) -> Serve raise

    Read mctl serve [package] [--reload] [--reload-dir dir]... [--reload-delay seconds] [-- args]. Everything after -- is the server's own.

    pin_module

    fn pin_module(mod : String, name : String, version : String) -> (String, String?)

    mod with name pinned at version, or mod unchanged when it does not pin that name. Returns the new text and the change it made, if any.

    pinned_version

    fn pinned_version(mod : String, name : String) -> String?

    The version name is pinned at in mod, or None when the file does not pin it.

    reload_delay

    let reload_delay : Int

    How long to wait between looks at the sources, in milliseconds (← uvicorn's --reload-delay, 0.25 seconds).

    reload_dirs

    let reload_dirs : Array[String]

    Which directories are watched when none are named (← uvicorn's --reload-dir, the current directory).

    subcommands

    fn subcommands(name : String) -> Array[String]

    The second word of a command that takes a sub-command, for a completion script that completes two levels deep.

    template_detail

    fn template_detail(t : TemplateEntry) -> String

    mctl template show <name>: one entry, and where it sits in the library.

    template_dir

    fn template_dir(root : String, t : TemplateEntry) -> String

    The directory t is read from, given the root the library resolves to. The root is the --home directory, or where --remote was checked out.

    template_starter

    fn template_starter(pins : Map[String, String]) -> Array[(String, String)]

    The files mctl template init writes: one entry under api/service, small enough to read in a minute and complete enough to serve the spec it is given. Both the file names and the text are templates, so a library is edited as templates and read back the same way.

    template_table

    fn template_table() -> String

    mctl template list: a table a reader scans rather than a paragraph they read.

    templates

    fn templates() -> Array[TemplateEntry]

    The bundled library, in the order it is listed.

    templates_of

    fn templates_of(kind : String) -> Array[TemplateEntry]

    The templates of one kind — the ones a gen of that kind may pick.

    upgrade_pins

    fn upgrade_pins(mod : String, modules : Array[String], version : String) -> (String, Array[String])

    mctl upgrade <version>: every name in modules moved to version, plus one line per name that changed. A name the file does not pin is left alone and reported as skipped — pinning it would be a change the user did not ask for.

    usage_text

    fn usage_text(version : String) -> String

    The mctl help page: what mctl is, then one line per command, then the flags every generator shares.