Skip to content

dev-formata-io/stof-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stof CLI

Command line interface for Stof.

A smart, declarative runtime for data workflows

What is Stof?

Stof works with other data formats to bridge the gap between static data and programmable documents. It is a lightweight, embeddable, and portable data logic format & platform for AI, infra-as-code, and config-heavy workflows. It's built to support:

  • Data-Mesh, Integration, & Orchestration glue-layer
  • Universal LLM & AI workflows, tools, & intersystem data
  • Smart configs with logic, types, units, schemas, & self-validation
  • Asynchronous validation & transformation

Think of it as a foundation for building robust and declarative data flows, config systems, or backend models.

Quick Example

const list users: [              // optional type and const specification for fields
    {
        name: "Joe Schmo",       // commas or semi-colons accepted, but optional
        cm height: 6ft + 1in     // Stof adds units and declarations are expressions
        age: +32;                // trailing commas or semi-colons are okay
    },                           // trailing commas in arrays are okay
]

{
    "json": "normal json data supported when you need it",
    str "enhanced": "but also with types, units, logic, functions, etc."

    child: {
        MiB space: 2GiB  // unit types perform conversions when cast (time, temp, mass, etc.)
        fn apis() -> str { "sections of your document now become APIs" }
    }
}

async fn joe() -> obj {                // functions are document data, just like fields
    for (const user in self.users) {
        if (user.name.lower().contains("joe")) return user;
    }
    null
}

#[main]                          // main attribute to mark this func for 'run'
#[custom({'ex': true})]          // metadata values (funcs, maps, objs, etc.)
fn main() {
    const joe = self.joe();
    assert(this.attributes().get("custom").get("ex"));
    
    async {                                // async at the core (funcs & exprs too)
        let body = stringify("toml", await joe); // any loaded format (binary & parse too)
        body.push("stof = true\n");
        pln(body);
    }
}
> stof run example.stof
age = 32
height = 185.42
name = "Joe Schmo"
stof = true

Installation

cargo install stof-cli

Add Stof to your Cargo.toml:

[dependencies]
stof = "0.8.*"

See installation docs for CLI instructions and more information.

Documentation

Status

Stof is currently in early development, we welcome feedback and contributions. The core is stable for experimentation, and is actively being used in production at Formata.

New features are being added weekly, so hop into the Discord and get involved!

License

Apache 2.0. See LICENSE for details.

Feedback & Community

  • Open issues or discussions on GitHub
  • Chat with us on Discord
  • Star the project to support future development!

Reach out to info@stof.dev to contact us directly

About

Command line interface for Stof.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages