# Usage
## Commands
```bash
sastri init [--config Sastri.toml] [--generate] [--root .]
sastri generate [--config Sastri.toml] [--root .] [--only ID]... [--force] [--no-tui]
sastri mechanisms
sastri secrets [--config Sastri.toml]
sastri --help
sastri --version
```
### `init`
Interactive wizard. Writes non-sensitive answers to `Sastri.toml`. With `--generate`, immediately runs generation into `--root` (default `.`) with `--force` semantics for that first pass.
### `generate`
Reads `Sastri.toml` and runs every **enabled** mechanism (or only those listed via repeated `--only`).
- `--force` — overwrite existing generated files
- `--no-tui` — spinner / plain progress (used in CI and scripts)
- `--root` — repository to write into (canonicalize when possible)
### `mechanisms`
Lists built-in mechanism ids with `stable` or `stub` status and a short description.
### `secrets`
Prints a checklist of GitHub secrets and external repos to create. Values are never stored.
## `Sastri.toml` reference
### `[project]`
| `name` | yes | Crate / product name (used for `cargo publish -p`) |
| `description` | yes | Short description for formulas / manifests |
| `github_owner` | yes | GitHub org or user |
| `github_repo` | yes | Repository name |
| `binary_name` | yes | Release binary and asset prefix |
| `version` | no | Default `0.1.0` — keep in sync with `Cargo.toml` |
| `license` | no | Default `MIT` |
| `cargo_manifest` | no | Default `Cargo.toml` (workspace-friendly path) |
| `homepage` | no | Defaults to `https://github.com/{owner}/{repo}` |
### `[org]`
Optional packaging destinations:
| `homebrew_tap` | `latentmeta/homebrew-tap` |
| `scoop_bucket` | `latentmeta/scoop-bucket` |
| `asdf_plugin_repo` | `latentmeta/asdf-sastri` |
| `npm_org` / `npm_package` | `latentmeta` / `@latentmeta/greet` |
| `pypi_package` / `hex_package` | PyPI / Hex names |
### `[mechanisms]`
Map of mechanism id → `true`/`false`. Unknown ids are ignored at generate time so future ecosystems can appear in config early.
Defaults from `SastriConfig::default_mechanisms` turn on CI, Releases, install.sh, Homebrew, Scoop, asdf, mise, setup Action, npm, PyPI, and Hex; stubs stay off.
### `[release]`
| `platforms` | five common targets | Matrix keys: `linux-x86_64`, `linux-aarch64`, `macos-aarch64`, `macos-x86_64`, `windows-x86_64` |
| `publish_crates_io` | `true` | Adds crates.io job to release workflow |
| `publish_sha256sums` | `true` | Reserved / documented; SHA256SUMS always generated in release job today |
### `[paths]`
Override output directories (defaults shown):
```toml
[paths]
packaging_dir = "packaging"
scripts_dir = "scripts"
workflows_dir = ".github/workflows"
actions_dir = ".github/actions"
```
## Library API
Sastri is primarily a CLI, but the crate exposes:
```rust
use sastri::{SastriConfig, GenerateOptions, generate};
let config = SastriConfig::load("Sastri.toml".as_ref())?;
generate(GenerateOptions {
config,
root: ".".into(),
only: None,
use_tui: false,
force: true,
})?;
```
Mechanisms implement `sastri::engine::Mechanism` and register in `engine::registry::all`.
## Extending (new ecosystems)
1. Add `src/engine/my_eco.rs` implementing [`Mechanism`](../src/engine/traits.rs)
2. Register in [`registry::all`](../src/engine/registry.rs)
3. Add a default key in `SastriConfig::default_mechanisms`
4. Ship — wizard / TUI / CLI need no other changes
Stubs `ruby_gem` and `haskell_cabal` are templates.
## Example config
See [`examples/Sastri.toml`](../examples/Sastri.toml). This repository’s root `Sastri.toml` is the dogfooded config for distributing `sastri` itself via brew, Scoop, asdf, and mise.