foundry_cli 0.0.1-dev.1 copy "foundry_cli: ^0.0.1-dev.1" to clipboard
foundry_cli: ^0.0.1-dev.1 copied to clipboard

CLI for Foundry — mold authoring, inspection, import, and cast workflows.

foundry_cli #

Command-line interface for Foundry — mold authoring, inspection, import, and cast workflows.

Preview release. Commands and flags may change before 1.0.0.

What it does #

The foundry executable wraps the foundry_core library with commands for the full mold lifecycle:

  • foundry mold init — scaffold a new mold package in the current directory
  • foundry mold inspect — validate mold layout, variables, and hooks
  • foundry mold import — copy a mold from git or a local path
  • foundry cast — gather variables, run hooks, and render templates to --output
  • foundry recast — replay the last successful cast from .foundry/last_cast.json
  • foundry finish — run only the finish hook against the last cast output

Molds are Dart packages with a root pubspec.yaml, variables.dart, a template/ tree, and optional lifecycle hooks. See the hook authoring guide and the mold pubspec schema.

Installation #

Install the CLI globally with dart install:

dart install foundry_cli

The global binary is foundry (executables: foundry:), even though the pub.dev package is foundry_cli.

foundry --version

Requires Dart SDK >=3.5.0 <4.0.0.

Quick start #

Scaffold a mold #

foundry mold init --name=hello_mold
cd hello_mold

Inspect #

foundry mold inspect

Cast #

foundry cast . --output=../hello_out

Foundry gathers variables through an interactive TUI, renders template/ into --output, and writes .foundry/last_cast.json in the process working directory on success.

Use --force to cast into a non-empty output directory. Use --no-hooks to skip all hook phases.

Recast and finish #

foundry recast
foundry finish

See the example/ directory for a bundled mold you can inspect and cast with dart run.

CLI reference #

Invocation #

foundry [--version] <command> [arguments] [options]

Global flags #

Flag Description
--version Print the CLI version and exit

Exit codes #

Code Meaning
0 Success
1 User-facing error (invalid input, mold load failure, hook abort, etc.)
2 Unexpected internal error

Commands #

Command Description
foundry mold init Scaffold a new mold in the current directory
foundry mold import git Import a mold from a git repository
foundry mold import local Import a mold from a local path
foundry mold inspect Validate and analyze a mold
foundry cast Cast a mold to an artifact at --output
foundry recast Re-run the last cast
foundry finish Run the finish hook for the last cast

foundry mold init

foundry mold init [--name=<name>]
Option Description
--name Mold package name (defaults to the current directory basename)

foundry mold import git

foundry mold import git --git-url=<url> [--path=<relative/path>] [--force]
Option Description
--git-url Required. Git repository URL to shallow-clone
--path Relative path to the mold within the repository
--force Overwrite the destination directory if it already exists

foundry mold import local

foundry mold import local --path=<dir> [--force]
Option Description
--path Required. Local directory containing the mold
--force Overwrite the destination directory if it already exists

foundry mold inspect

foundry mold inspect [<path>]
Argument Description
<path> Mold directory (defaults to the current directory)

foundry cast

foundry cast <mold-path> --output=<dir> [--force] [--no-hooks]
Argument / option Description
<mold-path> Required. Path to the mold directory
--output Required. Destination directory for rendered artifacts
--force Allow casting into a non-empty output directory
--no-hooks Skip prepare, shape, and finish hooks

foundry recast

foundry recast [--force] [--no-hooks]

Replays the last successful cast from .foundry/last_cast.json.

foundry finish

foundry finish [--no-hooks]

Runs only the finish hook against the last cast output without re-rendering templates.

Resources #

License #

MIT — see LICENSE.

0
likes
150
points
54
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

CLI for Foundry — mold authoring, inspection, import, and cast workflows.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#mason #template #codegen #cli #liquid

License

MIT (license)

Dependencies

args, foundry_core, nocterm, path

More

Packages that depend on foundry_cli