Sign in

    moonforge

    A MoonBit-native incremental task runner for small builds, codegen workflows, and local CI orchestration.

    moonbit
    build-tool
    task-runner
    incremental-build
    Download zip
    Author
    Version
    0.1.3
    License
    Apache-2.0
    Last updated
    2 months ago
    Downloads
    24

    #MoonForge

    MoonForge is a MoonBit-native incremental task runner for small builds, code generation pipelines, document workflows, asset preparation, and local CI.

    #Highlights

    • Declarative Moonforge.toml task configuration.
    • Dependency graph validation and cycle detection.
    • Input/output fingerprinting with .moonforge/cache.json.
    • run, list, graph, explain, stats, audit, clean, and doctor commands.
    • Bounded parallel execution by dependency level with -j N.

    #Quick start

    moon update
    moon check --fmt --deny-warn --target native
    moon fmt --check
    moon info
    moon test --deny-warn --target native
    moon run --target native cmd/main -- stats
    moon run --target native cmd/main -- audit

    #Configuration example

    [tasks.bundle] cmd = 'python -c "print(\"bundle\")"' deps = ["generate"] inputs = ["src/schema.json"] outputs = ["dist/bundle.txt"] phony = false desc = "Build the bundle"

    Supported fields are cmd, deps, inputs, outputs, phony, and desc. Tasks without outputs are treated as effectively phony.

    #CLI

    moonforge list [--file PATH] moonforge graph [TASK] [--file PATH] moonforge explain [TASK] [--file PATH] moonforge stats [--file PATH] moonforge audit [--file PATH] moonforge clean [--file PATH] moonforge doctor [--file PATH] moonforge run [TASK] [--file PATH] [-j N]

    MoonforgeError

    type MoonforgeError derive(
    Debug
    )

    AuditCode

    pub(all) enum AuditCode {
    DuplicateOutput
    OverlappingOutput
    MissingInput
    EmptyCommand
    UnreachableTask
    PhonyTaskInfo
    } derive(Eq,
    Debug
    )

    AuditFinding

    pub struct AuditFinding {
    severity : AuditSeverity
    code : AuditCode
    task : String
    related_task : String?
    path : String?
    message : String
    } derive(Eq,
    Debug
    )

    AuditReport

    pub struct AuditReport {
    stats : ProjectStats
    findings : Array[AuditFinding]
    } derive(
    Debug
    )

    AuditSeverity

    pub(all) enum AuditSeverity {
    Error
    Warning
    Info
    } derive(Eq,
    Debug
    )

    BenchmarkShape

    pub(all) enum BenchmarkShape {
    Chain
    Mixed
    Fanout
    } derive(Eq,
    Debug
    )

    BenchmarkSpec

    pub struct BenchmarkSpec {
    name : String
    task_count : Int
    depth : Int
    fanout : Int
    shape : BenchmarkShape
    } derive(Eq,
    Debug
    )

    CacheEntry

    pub struct CacheEntry {
    command_hash : String
    input_hash : String
    output_hash : String
    duration_ms : Int
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    CacheSnapshot

    pub struct CacheSnapshot {
    version : Int
    tasks : Map[String, CacheEntry]
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    CliCommand

    pub(all) enum CliCommand {
    Help
    List(config_path~ : String)
    Graph(config_path~ : String, target~ : String?)
    Explain(config_path~ : String, target~ : String?)
    Stats(config_path~ : String)
    Audit(config_path~ : String)
    Clean(config_path~ : String)
    Doctor(config_path~ : String)
    Run(config_path~ : String, target~ : String?, jobs~ : Int)
    } derive(
    Debug
    )

    PlanReason

    pub(all) enum PlanReason {
    FirstRun
    PhonyTask
    CommandChanged
    InputsChanged
    OutputMissing
    OutputsChanged
    DependencyReran(Array[String])
    UpToDate
    } derive(Eq,
    Debug
    )

    Project

    pub struct Project {
    root : String
    config_path : String
    tasks : Map[String, Task]
    } derive(
    Debug
    )

    ProjectStats

    pub struct ProjectStats {
    default_target : String
    total_tasks : Int
    root_tasks : Int
    leaf_tasks : Int
    phony_tasks : Int
    concrete_tasks : Int
    tasks_with_inputs : Int
    tasks_with_outputs : Int
    total_declared_inputs : Int
    total_declared_outputs : Int
    max_depth : Int
    duplicate_outputs : Int
    overlapping_outputs : Int
    missing_inputs : Int
    unreachable_tasks : Int
    } derive(
    Debug
    )

    RunMetrics

    pub struct RunMetrics {
    total_tasks : Int
    executed_tasks : Int
    skipped_tasks : Int
    total_duration_ms : Int
    average_duration_ms : Int
    cache_hit_percent : Int
    longest_task : String?
    longest_duration_ms : Int
    } derive(
    Debug
    )

    RunSummary

    pub struct RunSummary {
    plans : Array[TaskPlan]
    executed : Array[String]
    skipped : Array[String]
    durations_ms : Map[String, Int]
    } derive(
    Debug
    )

    Task

    pub struct Task {
    name : String
    cmd : String
    deps : Array[String]
    inputs : Array[String]
    outputs : Array[String]
    phony : Bool
    desc : String?
    } derive(Eq,
    Debug
    )

    Task::is_effectively_phony

    fn Task::is_effectively_phony(self : Task) -> Bool

    TaskPlan

    pub struct TaskPlan {
    task : Task
    reason : PlanReason
    should_run : Bool
    command_hash : String
    input_hash : String
    } derive(
    Debug
    )

    VisitState

    type VisitState derive(Eq,
    Debug
    )

    audit_code_label

    fn audit_code_label(code : AuditCode) -> String

    audit_project

    fn audit_project(project : Project) -> AuditReport raise MoonforgeError

    audit_severity_label

    fn audit_severity_label(severity : AuditSeverity) -> String

    audit_status

    fn audit_status(report : AuditReport) -> String

    benchmark_description

    fn benchmark_description(spec : BenchmarkSpec) -> String

    benchmark_specs

    fn benchmark_specs() -> Array[BenchmarkSpec]

    build_benchmark_project

    fn build_benchmark_project(spec : BenchmarkSpec) -> Project

    clean_project

    fn clean_project(project : Project) -> Array[String] raise MoonforgeError

    doctor

    fn doctor(project : Project) -> Array[String] raise MoonforgeError

    duplicate_outputs

    fn duplicate_outputs(project : Project) -> Array[(String, String, String)]

    empty_cache

    fn empty_cache() -> CacheSnapshot

    explain_task

    fn explain_task(project : Project, target : String?) -> Array[String] raise MoonforgeError

    help_text

    fn help_text() -> String

    list_tasks

    fn list_tasks(project : Project) -> Array[String]

    load_cache

    fn load_cache(project : Project) -> CacheSnapshot raise MoonforgeError

    load_project

    fn load_project(root? : String, config_path? : String) -> Project raise MoonforgeError

    make_plan

    fn make_plan(project : Project, cache : CacheSnapshot, target : String?) -> (Array[String], Array[Array[String]], Array[TaskPlan]) raise MoonforgeError

    metrics_csv_header

    fn metrics_csv_header() -> String

    metrics_csv_row

    fn metrics_csv_row(summary : RunSummary) -> String

    parse_cli

    fn parse_cli(args : Array[String]) -> CliCommand raise MoonforgeError

    plan_for_task

    fn plan_for_task(plans : Array[TaskPlan], task_name : String) -> TaskPlan?

    project_stats

    fn project_stats(project : Project) -> ProjectStats raise MoonforgeError

    reason_message

    fn reason_message(reason : PlanReason) -> String

    render_audit_report

    fn render_audit_report(project : Project) -> Array[String] raise MoonforgeError

    render_graph

    fn render_graph(project : Project, target : String?) -> Array[String] raise MoonforgeError

    render_project_stats

    fn render_project_stats(project : Project) -> Array[String] raise MoonforgeError

    render_run_metrics

    fn render_run_metrics(summary : RunSummary) -> Array[String]

    run_metrics

    fn run_metrics(summary : RunSummary) -> RunMetrics

    run_target

    async fn run_target(project : Project, target : String?, jobs? : Int) -> RunSummary raise MoonforgeError

    save_cache

    fn save_cache(project : Project, snapshot : CacheSnapshot) -> Unit raise MoonforgeError

    task_levels

    fn task_levels(project : Project, order : Array[String]) -> Array[Array[String]] raise MoonforgeError

    task_order

    fn task_order(project : Project, target : String?) -> Array[String] raise MoonforgeError

    task_summary_line

    fn task_summary_line(plan : TaskPlan) -> String

    validate_project

    fn validate_project(project : Project) -> Unit raise MoonforgeError

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io